text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; const int maxN = 1000000; long long a1, a2, t0, t1, t2, p1, p2, num, f, T, Tim, tot1, tot2, l, r, ans, Num; bool fl; void check1(long long my) { num = my / p1; if (num * a1 >= f) { if (t1 * f <= T) fl = 1; return; } for (long long...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.3 (win64) Build Mon Oct 10 19:07:27 MDT 2016 // Date : Tue Sep 19 16:38:23 2017 // Host : vldmr-PC running 64-bit Service Pack 1 ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1000006; char s[maxn]; int ans[8] = {1869, 8196, 1986, 8691, 6198, 1689, 1968}; int main() { while (scanf( %s , s) != EOF) { int len = strlen(s); int A[10] = {0}; for (int i = 0; i < len; i++) { A[s[i] - 0 ]++; ...
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1; char c = getchar(); while (!isdigit(c)) { if (c == - ) f = -1; c = getchar(); } while (isdigit(c)) { x = x * 10 + c - 0 ; c = getchar(); } return x * f; } const int mod = 998...
#include <bits/stdc++.h> using namespace std; const int N = 400 * 1000 + 10; vector<int> graph[N]; int n, num[N], par[N], ans[N], c1[N], c2[N]; void dfs(int v) { num[v]++; for (int i = 0; i < (int)graph[v].size(); i++) { int u = graph[v][i]; if (u != par[v]) { par[u] = v; d...
#include <bits/stdc++.h> using namespace std; bool prime(long long x) { if (x == 2) { return true; } if (x <= 1) { return false; } for (int i = 2; i < sqrt(x); i++) { if (x % i == 0) { return false; } } return true; } void printv(vector<long long> v) {...
/** * 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...
`timescale 1ns / 1ps // Documented Verilog UART // Copyright (C) 2010 Timothy Goddard () // Distributed under the MIT licence. // // 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 re...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; bool vis[N]; vector<int> prime; void sieve() { for (int i = 2; i * i < N; i++) { if (vis[i]) continue; for (int j = 2; j * i < N; j++) { vis[i * j] = 1; } } for (int i = 2; i < N; i++) { if (vis[i]...
#include <bits/stdc++.h> using namespace std; long long a, b, ans, w1, w2; int main() { cin >> a >> b; ans = 2 * a + 2 * b + 2; w1 = 2 * a + 2 * b + 2; w2 = 2 * a + 2 * b + 2; for (long long i = 1; i <= sqrt(a + b); i++) { if (a % i == 0 && a / i < w1) w1 = a / i; if (b % i == 0 &&...
#include <bits/stdc++.h> using namespace std; const int MAX_TAILLE = 100 * 1000 + 3; long long T[1]; long long paire[MAX_TAILLE], impaire[MAX_TAILLE]; int n, e, a; long long best; int main() { paire[0] = 0; impaire[0] = 0; int p = 1, ip = 1; cin >> n >> e; T[0] = 0; for (int 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 law...
/** * 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 code is generated by Terasic System Builder //======================================================= module CPC2( //////////// CLOCK ////////// input FPGA_CLK1_50, input FPGA_CLK2_50, input FPG...
// file: clk32to40_tb.v // // (c) Copyright 2008 - 2011 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 // laws. // // DISCLAIMER // This disclai...
#include <bits/stdc++.h> using namespace std; int main() { string s = abcdefghijklmnopqrstuvwxyz ; string s2 = ; int n, k; cin >> n >> k; for (int i = 0; i < n; i++) s2 += s[i % k]; cout << s2 << endl; return 0; }
/* * 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; const int N = 2e3 + 3; const int mod = 1e9 + 7; const int inf = 1e9 + 7; bool dp[N][N]; bool ok[N][10]; int cnt[N][10]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); string t[10]; t[0] = 1110111 ; t[1] = 0010010 ; t[2] = 1...
#include <bits/stdc++.h> using namespace std; int min(int a, int b) { if (a <= b) { return a; } else { return b; } } int max(int a, int b) { if (a >= b) { return a; } else { return b; } } int main() { int l, r, a; cin >> l >> r >> a; int MAX, MIN; ...
module dff(clk, d, q); input clk, d; output reg q; always @(posedge clk) q <= d; endmodule module dffa(clk, arst, d, q); input clk, arst, d; output reg q; always @(posedge clk or posedge arst) begin if (arst) q <= 1; else q <= d; end endmodule module dffa1(clk, arst, d, q); input clk, arst, d; output reg q; a...
/* * Copyright 2013, Homer Hsing <> * * 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 ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int arr[105]; for (int i = 0; i < n; i++) { cin >> arr[i]; } int visited[105] = {0}; for (int i = 0; i < n; i++) { visited[arr[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...
#include <bits/stdc++.h> using namespace std; int k; string res; int c[500]; int main(void) { for (int i = 2; i < 449; i++) { c[i] = i * (i - 1) / 2; } scanf( %d , &k); if (k == 0) { cout << a << endl; } char cur = a ; while (k > 0) { int takeind = upper_bound(...
#include <bits/stdc++.h> using namespace std; long long n; vector<long long> a; void solve() { cin >> n; a.resize(n); for (long long i = 0; i < n; ++i) { cin >> a[i]; } long long ans = 0; for (long long i = 0; i < n - 1; ++i) { if (a[i] >= 0) { a[i + 1] += a[i]; ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; int n; vector<int> a; long long inv[32][2]; void solve(vector<int> &a, int depth) { if (depth < 0) return; if (a.size() == 0) return; vector<int> left, right; long long cnt0 = 0, cnt1 = 0, sum01 = 0, sum10 = 0; for (...
////////////////////////////////////////////////////////////////////// //// //// //// WISHBONE SD Card Controller IP Core //// //// //// //// sd_controller_wb.v ...
#include <bits/stdc++.h> using namespace std; int main() { char a[505][505]; int i, n, j, c = 0; cin >> n; for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { cin >> a[i][j]; } } for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { if (a[i][j] == X ) { ...
#include <bits/stdc++.h> using namespace std; const long long int inf = 1e18; int n, m, k, x, p; int mat[1005][1005]; void solve(int tc) { cin >> n >> m >> k >> p; for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { cin >> mat[i][j]; } } multiset<int, greater<int> >...
#include <bits/stdc++.h> using namespace std; long long bigmod(long long a, int p, long long int m) { if (p == 0) return 1; if (p & 1) { return ((a % m) * (bigmod(a, p - 1, m))) % m; } else { long long tmp = bigmod(a, p / 2, m); return (tmp * tmp) % m; } } int main() { ios_...
/** * 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 long double PI = 3.14159265359; const long long MOD = (long long)1e9 + 7; const long long MAXN = (long long)1e5 + 10; const long long INF = (long long)9223372036854775; const long double EPS = (long double)1e-8; long long par[MAXN], sz[MAXN], ln[MAXN], p...
`timescale 1ns / 1ps `default_nettype none ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 20:16:31 12/26/2014 // Design Name: // Module Name: ps2_port // Project Name: // Target Devices: // Tool versions: // Description: //...
#include <bits/stdc++.h> using namespace std; const int N = 2020; int n, m, i, j, cnt[N]; char grid[N][N]; bool check(int s) { for (int i = 0; i < m; ++i) if (grid[s][i] == 1 && cnt[i] <= 1) return 0; return 1; } int main() { cin >> n >> m; for (i = 0; i < n; ++i) { scanf( %s...
// -- (c) Copyright 2009 - 2011 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 // -- laws. // -- // -- DISCLAIMER // -- This disclaimer is not a...
/* Distributed under the MIT license. Copyright (c) 2015 Dave McCoy () 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, mo...
/** * 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...
// // Generated by Bluespec Compiler, version 2013.01.beta5 (build 30325, 2013-01-23) // // On Mon Feb 3 15:05:32 EST 2014 // // // Ports: // Name I/O size props // c_request_get O 153 // RDY_c_request_get O 1 // RDY_c_response_put O 1 // RDY...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 08:18:40 03/03/2016 // Design Name: // Module Name: register // Project Name: // Target Devices: // Tool versions: // Description: // // Depend...
#include <bits/stdc++.h> using namespace std; int c[1200000], save[5500]; bool flag[1200000]; int main() { int n, k; while (scanf( %d%d , &n, &k) != EOF) { for (int i = 1; i <= n; i++) scanf( %d , &save[i]); sort(save + 1, save + n + 1); memset(c, 0, sizeof(c)); for (int i = 1; i...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int N = 510; const int MOD = 998244353; int a[N]; int b[N]; int dp[N][N]; void add_self(int& x, int y) { if ((x += y) >= MOD) { x -= MOD; } } void sub_self(...
#include <bits/stdc++.h> using namespace std; int sci[200005], bn[200005]; int main() { int n; while (scanf( %d , &n) != EOF) { int m, ple = 0, sat = 0, fi = 1, cn; map<int, int> mp; for (int i = 0; i < n; i++) { scanf( %d , &sci[i]); mp[sci[i]]++; } scanf( %d...
/** * 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 autoinst_name_bug245 ( ); /*AUTOINPUT*/ // Beginning of automatic inputs (from unused autoinst inputs) input \escaped*dot*named ; // To sub of Sub.v input logic clk; // To sub of Sub.v // End of automatics /*AUTOOUTPUT*/ // Beginning of automatic ...
#include <bits/stdc++.h> using namespace std; const int _ = 5e5 + 7; int n, m, a[_], b[_]; bool check(int mid) { memset(b, -1, sizeof(b)); b[0] = 0; for (int i = 1; i <= n; ++i) { int L = a[i], R = (a[i] + mid) % m; if (L <= R) { if (b[i - 1] <= R) b[i] = max(b[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 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() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long n, r, c, i, d, j = 0, a = 0, b = 0; string s; cin >> s; n = s.size(); r = 1; c = n; while (c > 20) { r++; c = ceil((float)n / (flo...
#include <bits/stdc++.h> using namespace std; class DS { public: DS(int rows, int cols) : _rows(rows), _cols(cols), _ans(0) { int n = rows + cols; _p.resize(n, -1); _r.resize(n, 0); _nr.resize(n, 0); _nc.resize(n, 0); for (int i = 0; i < rows; ++i) _nr[i] = 1; for (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 law...
/* * Copyright (c) 2015 Instrumentation Technologies * All Rights Reserved. * * $Id: $ */ // synopsys translate_off `timescale 1ns / 1ps // synopsys translate_on module axi_wr_fifo #( parameter DW = 64 , // data width (8,16,...,1024) parameter AW = 32 , // address width parameter FW = 5 ...
#include <bits/stdc++.h> using namespace std; map<long long, bool> mp; long long b, q, l, n, x, ans; signed main() { scanf( %lld%lld%lld%lld , &b, &q, &l, &n); if (abs(b) > l) { printf( 0 ); return 0; } if (l < 0) l = -l; for (long long i = 1; i <= n; i++) { scanf( %lld , &...
#include <bits/stdc++.h> using namespace std; int n, m; int a[120], b[120], c[120], d[120]; map<int, int> mp; vector<int> ans; int main() { memset(b, -1, sizeof(b)); scanf( %d %d , &n, &m); for (int i = 1; i <= m; i++) { int x, y; scanf( %d %d , &x, &y); b[x] = y; mp[x] =...
//-------------------------------------------------------------------------------- // // delay_fifo.v // Copyright (C) 2011 Ian Davis // // This program 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 Foundati...
module ioddr_tester ( input wire CLK, input wire CLKB, output wire ERR, output wire Q, input wire D ); parameter USE_PHY_ODDR = 1; parameter USE_PHY_IDDR = 1; parameter USE_IDELAY = 0; parameter DDR_CLK_EDGE = "SAME_EDGE"; // Data generator wire [1:0] g_dat; data_g...
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; template <typename T> struct modular { constexpr modular() : val(0) {} constexpr modular(const modular<T>& _m) : val(_m.val) {} template <typename U> constexpr modular(const U& _r = U()) { val = -MOD <= _r && _r < MO...
#include <bits/stdc++.h> using namespace std; int main() { string s; while (cin >> s) { int N = s.size(); int l = N - 1; for (; l > 0; --l) { for (int i = 0; i + l <= N; ++i) { string sub = s.substr(i, l); size_t head = s.find(sub); if (head != string:...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma ) #pragma GCC optimize( unroll-loops ) using namespace std; long long int MOD = 998244353; double eps = 1e-12; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL...
#include <bits/stdc++.h> using namespace std; const long long maxn = 4e6; const long double SADAT = 7.84e-17; const long long INF = 1e9; const long long mod = 1e9 + 7; const long double PI = 4 * atan((long double)1); long long pw(long long a, long long b) { return (!b ? 1 : (b & 1 ? a *...
#include <bits/stdc++.h> using namespace std; char s[3009], t[3009]; long long dp[3009][3009]; int n, m; long long bigmod(long long a, long long p) { long long r = 1ll; while (p) { if ((p & 1ll)) { r = (a * r) % 998244353ll; } a = (a * a) % 998244353ll; p >>= 1; } ...
#include <bits/stdc++.h> using namespace std; int main() { int ans = 0; long long p = 1, q = 2, r, n; cin >> n; while (q <= n) { ans++; r = q; q = p + q; p = r; } printf( %d n , ans); return 0; }
#include <bits/stdc++.h> using namespace std; const int maxn = 1e4 + 5; pair<int, int> p[maxn]; set<pair<int, int> > s; void solve(int l, int r) { if (r - l < 2) return; int mid = (l + r) / 2; solve(l, mid), solve(mid, r); for (int i = l; i < r; i++) s.insert(make_pair(p[mid].first, p[i].secon...
module top(input CLOCK_50, input [1:0] KEY, output [7:0] LED, output Tx, input Rx, output [3:0] Snd, input [3:0] SW, //DRAM signals output [12:0] DRAM_ADDR, output [1:0] DRAM_BA, output DRAM_CKE, output DRAM_CLK, output DRAM_CAS_N, o...
/** * 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 = 0x3f3f3f3f; int ma[10][10]; bool vis[20]; int isok[20][20], tmp[20][20]; int n, m, ok = 0; int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1}; void solve() { puts( YES ); if (n > 4) { for (int i = 1; i <= m; i++) { if ...
// Accellera Standard V2.3 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2008. All rights reserved. `include "std_ovl_defines.h" `module ovl_bits (clock, reset, enable, test_expr, fire); parameter severity_level = `OVL_SEVERITY_DEFAULT; parameter min = 1; parameter max ...
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2017.3 (win64) Build Wed Oct 4 19:58:22 MDT 2017 // Date : Fri Nov 17 14:49:55 2017 // Host : egk-pc running 64-bit major release (build...
/* * Milkymist SoC * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq * * This program 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, version 3 of the License. * * This program is distribut...
#include <bits/stdc++.h> using namespace std; int read(int &x) { return scanf( %d , &x); } int read(int &x, int &y) { return scanf( %d%d , &x, &y); } int read(int &x, int &y, int &z) { return scanf( %d%d%d , &x, &y, &z); } int read(long long &x) { return scanf( %lld , &x); } int read(long long &x, long long...
#include <bits/stdc++.h> using namespace std; int L; int a[100005], n; int Min[100005 << 2], sub[100005 << 2]; vector<pair<int, int> > ans; void PushUp(int rt) { Min[rt] = min(Min[rt << 1], Min[rt << 1 | 1]); } void PushDown(int rt) { if (sub[rt]) { sub[rt << 1] += sub[rt]; sub[rt << 1 | 1...
#include <bits/stdc++.h> using namespace std; int main() { int name[100], i, j = 0; string codename; cin >> codename; for (i = 0; i < codename.length(); i++) { name[j] = (int)codename[i]; j++; } sort(name, name + j); int count = 0; for (int k = 1; k < j; k++) { if (...
#include <bits/stdc++.h> using namespace std; void calc(int n, int p) { int j = 1, k = 1; int cnt = 0; int here = 1; for (int i = 0; i < 2 * n + p; i++) { cout << j << ; j += k; if (j > n) j -= n; cout << j << endl; cnt++; int tmp = j + k; if (tmp > n) tm...
/* * 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...
/** * 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, a[111111], b[111111], c[111111], d[111111]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); } for (int i = 1; i <= n; i++) { scanf( %d , &b[i]); } for (int i = 1; i <= n; i++) { c[i] = a...
#include <bits/stdc++.h> using namespace std; int main() { string zbor1, zbor2; cin >> zbor1; int n, i, j; n = zbor1.length(); if (n < 10) { cout << NO ; return 0; } for (i = n - 1; i >= n - 10; i--) { zbor2 = zbor2 + zbor1[i]; } if (zbor2 == SECROFEDOC ) { ...
/** * 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 generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2017.2 // Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved. // // ============================================================== `timescale 1 ns / 1 ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 02/20/2017 09:46:54 PM // Design Name: // Module Name: fifo2shiftreg_tb // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: ...
/////////////////////////////////////////////////////////////////////////////// // // File name: axi_protocol_converter_v2_1_7_b2s_rd_cmd_fsm.v // /////////////////////////////////////////////////////////////////////////////// `timescale 1ps/1ps `default_nettype none (* DowngradeIPIdentifiedWarnings="yes" *) module a...
#include <bits/stdc++.h> using namespace std; int n, s1[1000005], r, s2[1000005], dp[1000005], w, mi, mid, ma; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &s1[i]); } for (int i = 1; i <= n; i++) { scanf( %d , &r); s2[r] = i; } for (int i = 1; ...
#include <bits/stdc++.h> inline int Abs(int x) { return x < 0 ? -x : x; } inline int Sgn(int x) { return x < 0 ? -1 : 1; } const int MN = 100005, Sig = 26; const int ML = 100005; const int MQ = 100005; const int T = 400; const int B = 400; int N, Id[MN], Len[MN]; char str[ML]; int nxt[ML][Sig], faz[...
#include <bits/stdc++.h> using namespace std; struct ii { string zl; int x, id; } zl[1000005]; bool cmp1(ii a, ii b) { if (a.x < b.x) return 1; if (a.x > b.x) return 0; return a.zl < b.zl; } bool cmp2(ii a, ii b) { return a.id < b.id; } int n, cnt, zhi[1000005], sz[1000005], i; long ...
#include <bits/stdc++.h> using namespace std; long long x[100005], y[112345]; set<long long> stx, sty; int main() { long long n, m, a, b; scanf( %lld %lld , &n, &m); long long total = n * n; while (m--) { scanf( %lld %lld , &a, &b); if (x[a] == 0 && y[b] == 0) { total = total...
// // Copyright (c) 1999 Peter Monta () // // 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) // an...
/* Copyright (c) 2015 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,...
/* Top level module for keypad + UART demo */ module top ( // input hardware clock (12 MHz) hwclk, // all LEDs led1, // UART lines ftdi_tx, ); /* Clock input */ input hwclk; /* LED outputs */ output led1; /* FTDI I/O */ output ftdi_tx; /* 9600 Hz clock gener...
/* Copyright 2018 Nuclei System Technology, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except i...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// module lcd_write_number ( input CLK_50MHZ, output LCD_E, output LCD_RS, output LCD_RW, output [3:0] LCD_D, input [31:0] if_data, input if_write, output if_ready ); reg [7:0] disp_data; reg disp_rs; reg [31:0] disp_del...
#include <bits/stdc++.h> using namespace std; vector<int> g[1002]; bool vis[1002]; bool my[1002], chen[1002]; int dfs(int n) { if (my[n] == 1) return n; vis[n] = 1; for (int i = 0; i < g[n].size(); i++) { int v = g[n][i]; if (!vis[v]) { int ans = dfs(v); if (ans != -1) ...
#include <bits/stdc++.h> const int fin = 0, maxn = 400000, maxm = maxn << 1; int n, m, cent, tot; int fs[maxn], e[maxm], next[maxm]; int bel[maxn], pos[maxn], len[maxn], left[maxn]; int c[maxn], deg[maxn], b[maxn]; bool v[maxn]; struct rec { int x, y; } g[maxn]; int sum(int *a, int n, int x) { ...
module etx_remap (/*AUTOARG*/ // Outputs emesh_access_out, emesh_packet_out, // Inputs clk, reset, emesh_access_in, emesh_packet_in, remap_en, remap_bypass, etx_rd_wait, etx_wr_wait ); parameter AW = 32; parameter DW = 32; parameter PW = 104; parameter ID = 12'h808; //Clock/reset ...
#include <bits/stdc++.h> using namespace std; const int MX = 300300; int t, n, m, i, k[MX], c[MX]; long long r; int main() { cin >> t; while (t--) { int n, x, sum = 0, ctr = 0; cin >> n >> x; int arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; sum += arr[i]...
//date:2016/3/20 //engineer:ZhaiShaoMin //module name: PHT :Pattern History Table module core_pht(//input clk, rst, if_pc, // pc[10:5] id_pc, // pc[10:5] update_BP, pred_right, taken, ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 20:31:09 02/22/2015 // Design Name: // Module Name: PackAdder // Project Name: // Target Devices: // Tool versions: // Description: // // Depen...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: scdata_periph_io.v // Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. // // The above named program is free software; you can redistribute it ...
/** * 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> struct stack { char a[1000010]; int top; } st; void push(char val) { st.a[st.top++] = val; } int pop() { return st.a[--st.top]; } int empty() { return st.top == 0; } char s[1000010]; int main() { char t; int i, cnt = 0; gets(s); st.top = 0; for (i = 0; ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int a[n]; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = n; i >= 1; i--) cout << a[i] << ; cout << endl; } }