text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; int N, K; int A[300005]; int DP[300005]; bool chk(int d) { int mxp = 0; for (int i = K; i <= N; i++) { if (A[i] - A[DP[i - K] + 1] <= d) mxp = i; DP[i] = mxp; } return mxp == N; } int main() { cin >> N >> K; for (int i = 1; ...
#include <bits/stdc++.h> using namespace std; int n, x; long long f[200010]; vector<pair<int, long long> > ke[200010]; struct te { int l, r; long long s; } a[200010]; bool cmp(te i, te j) { return ((i.l < j.l) || (i.l == j.l && i.r < j.r)); } int main() { if (fopen( a.txt , r )) { fre...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: Tecnológico de Costa Rica // Engineer: Juan José Rojas Salazar // // Create Date: 30.07.2016 10:22:05 // Design Name: // Module Name: ROM_test // Project Name: // Target Devices: // Tool Versions: ...
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, s = 0; cin >> a >> b; while (b > 1) { if (b > a) swap(a, b); s += a / b; a -= (b * (a / b)); if (a < 1) break; } s += a; cout << s << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int n, m, a[110]; double f[110][110][110], C[110][110]; int main() { scanf( %d%d , &n, &m); for (int i = 1; i <= m; i++) scanf( %d , &a[i]); C[0][0] = 1; for (int i = 1; i <= 55; i++) { C[i][0] = 1; for (int j = 1; j <= i; j++) C[i][j] = ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; vector<vector<int> > v(n, vector<int>(7, 0)); for (int i = 0; i < n; i++) { cin >> s; for (int j = 0; j < 7; j++) v[i][j] = s[j] - 0 ; } vector<int> cnt(7, 0); for (int i = 0; i < 7; i+...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/** * This is written by Zhiyang Ong * for EE577b Homework 4, Question 3 */ //`include "/auto/home-scf-06/ee577/design_pdk/osu_stdcells/lib/tsmc018/lib/osu018_stdcells.v" // Behavioral model for the SIPO convertor module SIPO(data_out, out_valid, serial_in, in_valid, reset_b, clk); // Output signals representing...
module trigTable_tb (); /////////////////////////////////////////////////////////////////////////// // PARAMETER AND SIGNAL DECLARATIONS /////////////////////////////////////////////////////////////////////////// wire signed [17:0] sin; wire signed [17:0] cos; reg signed [17:0] expectedSin; reg signed [17:0] expecte...
// megafunction wizard: %LPM_FIFO+% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: dcfifo // ============================================================ // File Name: fifo_32x512a.v // Megafunction Name(s): // dcfifo // ============================================================ // **************...
// limbus_cpu.v // This file was auto-generated from altera_nios2_hw.tcl. If you edit it your changes // will probably be lost. // // Generated using ACDS version 15.1 185 `timescale 1 ps / 1 ps module limbus_cpu ( input wire clk, // clk.clk input w...
module bram_tb #( parameter ABITS = 8, DBITS = 8, parameter INIT_ADDR = 0, INIT_DATA = 0 ); reg clk; reg [ABITS-1:0] WR_ADDR; reg [DBITS-1:0] WR_DATA; reg WR_EN; reg [ABITS-1:0] RD_ADDR; wire [DBITS-1:0] RD_DATA; bram uut ( .clk (clk ), .WR_ADDR(WR_ADDR), .WR_DATA(WR_DATA), .WR_EN (WR_EN ), ...
#include <bits/stdc++.h> using namespace std; const long long MAXN = 2e5 + 5; const long long SQRTN = 1003; const long long LOGN = 22; const double PI = acos(-1.0); const long long INF = 1e18; const long long MOD = 1e9 + 7; const long long FMOD = 998244353; const double eps = 1e-9; void __print(long...
#include <bits/stdc++.h> using namespace std; const int N = 300001; int n, a, b, c, d, start, len; vector<int> T; long long dp[2][N + 2], seg[4 * N]; void build(int p, int s, int e) { if (s == e) { seg[p] = dp[1][s]; return; } build(2 * p, s, (s + e) / 2); build(2 * p + 1, (s + e...
#include <bits/stdc++.h> using namespace std; long long leader[110000], p[110000]; long long n, m, i, j, k; bool can(long long cost) { for (i = 0, j = 0; i < n && j < m; ++i) { long long summ = cost; if (leader[i] == p[j] && j < m) ++j; if (j >= m) break; summ -= abs(leader[i] - p[j]...
/* * Copyright (c) 2001 Stephen Williams () * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU * General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) * ...
#include <bits/stdc++.h> using namespace std; int a1, a2; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> a1 >> a2; int res = 0; if (a1 == 1 && a2 == 1) { cout << 0 << n ; return 0; } while (a1 > 0 && a2 > 0) { if (a1 < a2) ++a1, a2 -= 2...
#include <bits/stdc++.h> using namespace std; bool comp(int a, int b) { return a < b; } int main() { stack<int> s; int N, t; cin >> N; while (N--) { cin >> t; if (s.empty()) { s.push(t); } else { if (((s.top()) & 1) == (t & 1)) s.pop(); else ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int n, ans = 1e9; vector<vector<int> > cnt(65); vector<set<int> > ed; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n; ed.resize(n + 1); bool tw = false; for (int i = 0; i < n; i++) { long long a; cin >> a; int ...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 10; set<int> s; int n, t; char a[maxn]; int pos; int main() { register int i, tail, g; scanf( %d%d , &n, &t); scanf( %s , a + 1); for (i = 1; i <= n; i++) if (a[i] == . ) { pos = i; break; } ...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a[n]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { int x; cin >> x; x--; a[i].push_back(x); } } int ans = 0; for (int j = 0; j < m; j...
// DESCRIPTION: Verilator: Verilog Test module // // A test of the +verilog1995ext+ and +verilog2001ext+ flags. // // This source code contains constructs that are valid in Verilog 2001 and // SystemVerilog 2005/2009, but not in Verilog 1995. So it should fail if we // set the language to be 1995, but not 2001. // // C...
#include <bits/stdc++.h> using namespace std; const int MAXN = 5005, MAXC = 1000005; int a[MAXN], b[MAXC], c[MAXC]; int n, k, _max; int main() { if (0) { freopen( input.txt , r , stdin); freopen( output.txt , w , stdout); }; scanf( %d%d , &n, &k); for (int i = 1; i <= n; i++) sca...
#include <bits/stdc++.h> using namespace std; void enable_comma() {} string tostring(char c) { string s = ; s += c; return s; } string tostring(string s) { return + s + ; } string tostring(const char *c) { return tostring((string)c); } string tostring(long long x) { if (x < 0) ret...
#include <bits/stdc++.h> using namespace std; long long a, b, x, n; void input() { cin >> a >> b >> n >> x; return; } long long powmod(long long a, long long b) { if (b == 1) return a; if (b < 1) return 1; long long t = powmod(a, b / 2) % 1000000007; t = (t * t) % 1000000007; if (b...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2010 Xilinx, Inc. // All Right Reserved. /////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / Vendor : Xilinx // \ \ \/ Version : 13....
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) { unordered_map<char, int> mp; int n; cin >> n; string arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; for (aut...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 5; int n, m, h, t, u, v, src[MAXN], dst[MAXN], num[MAXN], used[MAXN]; vector<int> g[MAXN]; void out(vector<int> &v) { for (int i = 0; i < v.size(); ++i) { cout << v[i] << n [i == v.size() - 1]; } } bool check(int u, int ...
#include <bits/stdc++.h> using namespace std; const int fx[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}; const int fxx[8][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}, {1, 1}, {1, -1}, {-1, 1}, {-1, -1}}; int gcD(int a, int b) { while (a && b) a > b ? a %= b : b %= a; return a + b; }...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int main() { int j, t, n, m = 0, i; unsigned long long p = 0, q = 0; char a[1000001]; cin >> a; n = strlen(a); for (j = 0; j < n; j++) { if (a[j] == ^ ) { break; } } for (i = j - 1; i >= 0; i--) { if ((a[i] >= ...
#include <bits/stdc++.h> using ld = long double; using ll = long long; using namespace std; int MOD = 998244353; void solve() { int n; cin >> n; vector<vector<int>> p(n + n, vector<int>(n)); for (int i = 0; i < 2 * n; i++) { for (int j = 0; j < n; j++) { cin >> p[i][j]; p[i][j]--; ...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2015.1 // Copyright (C) 2015 Xilinx Inc. All rights reserved. // // ============================================================== `timescale 1 ns / 1 ps mod...
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /stack:200000000 ) #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native ) #pragma GCC optimize( -ffloat-store ) #define fastio ios::sync_with_stdio(0); cin.tie(0); cout.t...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const int N = 32000; const int mod = 1000000007; const int inf = 2 * mod; int dp[5001][5001]; pair<long long, long long> hashVal[5001]; pair<long long, long long> powVal[5001]; const long long base1 = 37; const long long base2 = 2017; const long long mod...
#include <bits/stdc++.h> using namespace std; long long a[200001]; long long search(long long l, long long h, long long target) { if (h - l <= 1) { if (a[l] > target) return l; else return h; } long long mid = (l + h) / 2; if (a[mid] > target) return search(l, mid...
#include <bits/stdc++.h> using namespace std; int main() { long long n, m, q; cin >> n >> m >> q; vector<long long> a(n, 0); for (int i = 0; i < n; ++i) cin >> a[i]; vector<int> weights(m, 0); vector<int> heavyListsIds; vector<vector<int> > lists(m, vector<int>()); int heavyBorder = ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; signed main() { long long n; cin >> n; long long ans = 0; long long L = -4 * 45, R = 45; map<long long, long long> vls; for (long long i = L; i <= R; i++) vls[i] = 1e18; for (long long i = 0; i < 100; i++) { for (long long j = 0; j < 10...
#include <bits/stdc++.h> using namespace std; int main() { long long i, j, n, m, k, a, b; long long x[3], y[3]; for (i = 0; i < 3; i++) cin >> x[i] >> y[i]; cout << 3 << endl; for (i = 0; i < 3; i++) cout << (x[i] + x[(i + 1) % 3]) - x[(i + 2) % 3] << << (y[i] + y[(i + 1) % ...
#include <bits/stdc++.h> using namespace std; int L[100007], R[100007]; int n; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d%d , L + i, R + i); } sort(L + 1, L + n + 1); sort(R + 1, R + n + 1); long long ans = 0; for (int i = 1; i <= n; i++) { ans...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 09:16:03 03/03/2016 // Design Name: // Module Name: data_memory // Project Name: // Target Devices: // Tool versions: // Description: // // Dep...
#include <bits/stdc++.h> const int MX = 2e6 + 7; const int N = 1e9 + 1; const int mod = 998244353; const double pi = acos(-1); double esp = 1e-13; using namespace std; long long qpow(long long a, long long b, long long MOD = mod) { for (long long ans = 1;; a = a * a % MOD, b >>= 1) { if (b & 1) ...
#include <bits/stdc++.h> using namespace std; set<int> Tmp, Trans; int dp[(500 + 5)][(500 + 5)], n, m, A[(500 + 5)], B[(500 + 5)]; int from[(500 + 5)][(500 + 5)][2], rkA[(500 + 5)], rkB[(500 + 5)]; int trans[(500 + 5)][(500 + 5)]; int getrk(int x) { int TP = 0; for (set<int>::iterator i = Trans.begi...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: Jafet Chaves Barrantes // // Create Date: 11:05:08 05/26/2016 // Design Name: // Module Name: microcontrolador // Project Name: // Target Devices: // Tool versions: // Descripti...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); for (int i = 0; i < (n / 2); i++) printf( 01 ); if (n % 2) printf( 0 ); printf( n ); return 0; }
//***************************************************************************** // (c) Copyright 2013 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // ...
#include <bits/stdc++.h> using namespace std; const int maxn = 5e5 + 100; class Node { public: int l, r; bool operator<(const Node &a) const { return r < a.r; } }; Node n[maxn]; int main() { int N; scanf( %d , &N); for (int i = 0; i < N; i++) scanf( %d%d , &n[i].l, &n[i].r); sort(...
// // Copyright (c) 1999 Steven Wilson () // // This source code is free software; you can redistribute it // and/or modify it in source code form under the terms of the GNU // General Public License as published by the Free Software // Foundation; either version 2 of the License, or (at your option) // ...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 7; const long long inf = 1e17 + 7; pair<long long, long long> a[maxn]; pair<long long, long long> A[maxn]; pair<pair<long long, long long>, pair<long long, long long> > S[maxn]; int pos; inline long long elf(pair<long long, long long> ...
#include <bits/stdc++.h> using namespace std; bool forms(long long a, long long b, long long c) { if ((a * a) + (b * b) == (c * c)) return true; return false; } signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long t, n; cin >> t; while (t--) { ...
module testbench(); parameter NO_GPIO = 8; parameter SO_GPIO = 8; parameter EA_GPIO = 8; parameter WE_GPIO = 8; parameter NO_DOMAINS = 2; parameter SO_DOMAINS = 2; parameter EA_DOMAINS = 2; parameter WE_DOMAINS = 2; // Beginning of automatic inputs (from unused autoinst inputs) wire [E...
module uc(input wire clock,reset,z, input wire [1:0] id_out, input wire [5:0] opcode, output reg s_inc, s_inm, we3, rwe1, rwe2, rwe3, rwe4, sec, sece, s_es, s_rel, swe, s_ret, output wire [2:0] op); assign op = opcode[2:0]; always @(*) begin rwe1 <= 1'b0; //Desactivar puertos de E/S rw...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; int n, k, a[1010][1010]; vector<pair<int, int>> ans; int main() { int is = 0; ans.clear(); memset(a, 0, sizeof(a)); cin >> n >> k; for (int i = 1; i <= n; ++i) { int cnt = 0; for (int j = 1; j <= n; ++j...
// CPU and memory bundled together, // exposing the UART bare wires module tiny1_cpu( input clk, input rst, // external reset button input [7:0] uart_din, input uart_valid, input uart...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; char s1[1010], s2[1010]; int dp[1010][1010][15][2], n, m, k; int main() { scanf( %d%d%d , &n, &m, &k); scanf( %s%s , s1, s2); for (int i = 1; i <= k; i++) { for (int j1 = 1; j1 <= n; j1++) { for (int j2 = 1; j2 <= m; j2++) { if (s...
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > upd; struct query { int l, r, t, id, ans; query() {} query(int _l, int _r, int _t, int _id) { l = _l; r = _r; t = _t; id = _id; } }; vector<query> que; stack<pair<int, int> > S; vector<int> V; i...
`define bsg_mux_one_hot_gen_macro(words,bits) \ if (harden_p && els_p == words && width_p == bits) \ begin: macro \ bsg_rp_tsmc_250_mux_w``words``_b``bits w``words``_b``bits \ (.* ...
#include <bits/stdc++.h> template <class T> inline void checkmax(T &x, T y) { if (x < y) x = y; } template <class T> inline void checkmin(T &x, T y) { if (x > y) x = y; } template <class T> inline T Min(T x, T y) { return (x > y ? y : x); } template <class T> inline T Max(T x, T y) { ...
#include <bits/stdc++.h> using namespace std; int main() { int a[256], n, k, p; cin >> n >> k; memset(a, -1, sizeof(a)); for (int i = 0; i < n; i++) { cin >> p; if (a[p] == -1) { for (int j = max(0, p - k + 1); j <= p; j++) if (a[j] == -1 || a[j] == j) { for...
#include <bits/stdc++.h> using namespace std; int const MOD = 1000000007; void add(int &a, int b) { a += b; if (a >= MOD) a -= MOD; } int f[42], when[42]; int main() { int n, k; scanf( %d%d , &n, &k); int s = 1; int c = getchar(); while (c <= 32) { c = getchar(); } ...
#include <bits/stdc++.h> using namespace std; const int maxN = 100010; int n, parent[maxN], child[maxN]; long long f[maxN], g[maxN], res; struct ioi { int v, w; }; vector<ioi> adj[maxN]; void dfs(int u) { child[u] = 1; for (int i = 0; i < adj[u].size(); ++i) { int v = adj[u][i].v; ...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; long long by = (n / 2) + (n / 3) + (n / 5) + (n / 7) - (n / 6) - (n / 10) - (n / 14) - (n / 15) - (n / 35) - (n / 21); by += (n / 30) + (n / 42) + (n / 70) + (n / 105); by -= (n / 210); cout ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string str; cin >> str; set<char> a; for (int i = 0; i < n; i++) { a.insert(tolower(str[i])); } if (a.size() == 26) { cout << YES << endl; } else { cout << NO << endl; } retu...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 10:16:31 03/03/2016 // Design Name: signext // Module Name: G:/ceshi/lab4.3/test_for_signext.v // Project Name: lab4.3 // Target Device: // Tool version...
#include <bits/stdc++.h> using namespace std; const int Maxn = 1e7 + 10, M = 998244353; int n, m, k, inv[Maxn], s[Maxn], idk[Maxn]; int mo2(int x) { return (x < 0) ? x + M : x; } int fpow(int a, int p = M - 2) { int ret = 1; for (; p; p >>= 1, a = 1ll * a * a % M) if (p & 1) ret = 1ll * ret * a ...
// ============================================================================ // Copyright (c) 2010 // ============================================================================ // // Permission: // // // // Disclaimer: // // This VHDL/Verilog or C/C++ source code is intended as a design reference ...
`timescale 1ns / 1ps /* All files are owned by Kris Kalavantavanich. * Feel free to use/modify/distribute in the condition that this copyright header is kept unmodified. * Github: https://github.com/kkalavantavanich/SD2017 */ ////////////////////////////////////////////////////////////////////////////////// // Creat...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const int INF = INT_MAX; const long long INFL = LLONG_MAX; int N, M, ans[200100], n, m; int main() { cin >> N >> M; n = m = 0; ans[0] = 0; n++; for (int(i) = 1; (i) <= (N + M - 1); (i)++) { if (i & 1) { if (ans[i - 1]) { ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/* Copyright (c) 2016 Alex Forencich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute,...
/** * This is written by Zhiyang Ong * and Andrew Mattheisen * for EE577b Troy WideWord Processor Project */ `timescale 1ns/10ps /** * `timescale time_unit base / precision base * * -Specifies the time units and precision for delays: * -time_unit is the amount of time a delay of 1 represents. * The time uni...
#include <bits/stdc++.h> using namespace std; const int MAX_N = 1000000; struct UnionFind { int par[MAX_N], ra[MAX_N]; void init(int n) { for (int(i) = 0; (i) < (n); (i)++) par[i] = i, ra[i] = 0; } int find(int x) { return par[x] == x ? x : par[x] = find(par[x]); } bool same(int x, int y...
#include <bits/stdc++.h> using namespace std; long long int a[100001]; vector<long long int> adj[100001]; long long int ans[21] = {}; long long int dp[100001][21][2]; void dfs(long long int i, long long int par) { long long int u = 0; for (long long int j = 0; j < adj[i].size(); j++) { long lo...
(* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed u...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2013 by Jeremy Bennett. module t (/*AUTOARG*/); typedef enum int { PADTYPE_DEFAULT = 32'd0, PADTYPE_GPIO, PADTYPE_VDD, PADTYPE_GND } t_padtype; ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/////////////////////////////////////////////////////////////////////////////// // // File name: axi_protocol_converter_v2_1_8_b2s_wr_cmd_fsm.v // /////////////////////////////////////////////////////////////////////////////// `timescale 1ps/1ps `default_nettype none (* DowngradeIPIdentifiedWarnings="yes" *) module a...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, ta, tb; cin >> a >> ta >> b >> tb; int t, m; char c; cin >> t >> c >> m; m += 60 * t; int cur = 5 * 60; int res = 0; while (cur < 24 * 60) { if (min(cur + tb, m + ta) > max(cur, m)) ++res; cur += b; ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
module Tx8b10b_tb (); reg clk; // System clock reg rst; // Reset; synchronous and active high reg en; // Enable bit reg [7:0] dataIn; // Data to transmit reg writeStrobe; // Write data to transmit FIFO wire dataPresent; // FIFO has data still in it wire halfFull; // FIFO halfway full w...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const int N = 9; const double eps = 1e-11; const int inf = (int)2e9; const int mod = (int)1e9 + 7; const double pi = 3.1415926535897932384626433832795; int a[N]; int main() { int n, k; scanf( %d %d , &n, &k); int ex = 0; for (int i = 1; i <= ...
#include <bits/stdc++.h> using namespace std; bool check(int a, int b, int frst, int s) { return a * frst / (double)s >= (double)b; } int main() { int n, a, b, *arr; cin >> n >> a >> b; arr = new int[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } sort(arr + 1, arr + n); ...
#include <bits/stdc++.h> using namespace std; inline void read(int &x) { int v = 0, f = 1; char c = getchar(); while (!isdigit(c) && c != - ) c = getchar(); if (c == - ) f = -1; else v = (c & 15); while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15); x = v * f;...
#include <bits/stdc++.h> int ans = 0; double H = 100, len = 100000; int F[110000], T[110000], FF[110000], TT[110000]; bool vis[110000]; int judge(bool fuck, double st, double t) { int ret = 0; int top, flo; double point = st; memset(vis, 0, sizeof(vis)); while (point < len) { top = (...
// (C) 1992-2014 Altera Corporation. All rights reserved. // Your use of Altera Corporation's design tools, logic functions and other // software and tools, and its AMPP partner logic functions, and any output // files any of the foregoing (including device programming or simulati...
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7, siz = 1e6 + 5; long long q, n, m, a[siz], rot[66]; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> q; while (q--) { long long op; cin >> op; if (op <= 2) { long long node, k; ...
#include <bits/stdc++.h> using namespace std; map<long long, long long> m; long long f(string s) { long long ff[27] = {0}, ans = 0, i, j; for (i = 0; i < s.size(); i++) { ff[s[i] - a ]++; } for (i = 0; i < 26; i++) { if (ff[i] % 2) { ans |= (1LL << i); } } return...
/* This file is part of JT12. JT12 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. JT12 is distributed in the hope tha...
#include <bits/stdc++.h> using namespace std; long long int gcd(long long int a, long long int b) { if (a == 0) return b; else return gcd(b % a, a); } long long int power(long long int a, long long int b, long long int m) { long long int ans = 1; while (b) { if (b & 1) ans = (a...
#include <bits/stdc++.h> using namespace std; const int maxn = 3e5 + 5; int n, m; int first[maxn], second[maxn]; void solve() { cin >> n >> m; for (int i = 1; i <= m; ++i) cin >> first[i] >> second[i]; int a, b; a = first[1]; b = -1; for (int i = 1; i <= m; ++i) { if (first[i] !=...