text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; long long n, s, x, y, nb; vector<pair<long long, long long> > t, v; long long dp[102]; bool cmp(pair<long long, long long> a, pair<long long, long long> b) { return a.first + a.second > b.first + b.second; } int main() { ios_base::sync_with_stdio(0); ...
#include <bits/stdc++.h> using namespace std; template <class T> T Bitcnt(T a) { int sum = 0; while (a) { if (a & 1) sum++; a /= 2; } return sum; } template <class T> T Max3(T a, T b, T c) { return max(a, max(b, c)); } template <class T> T Lcm(T a, T b) { T tmp = __...
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; template <class T> typename T::value_type arr_sum(const T& v, int n) { typename T::value_type sum = 0; for (int i = (0); i < (n); ++i) sum += v[i]; return sum; } struct Sync_stdio { Sync_stdio() { cin.tie(NULL); ...
#include <bits/stdc++.h> using namespace std; int n, m, k; long long pow2(int x) { if (x == 0) return 1; if (x == 1) return 2; long long h = pow2(x / 2); return (h * h * (x & 1 ? 2 : 1)) % 1000000009; } int main() { cin >> n >> m >> k; int x = n / k; int y = n % k; int z = m - ...
#include <bits/stdc++.h> using namespace std; string name[105], body[105]; int n; string s; int d[105]; map<string, int> macro_id; int add(string& s, int& ptr); void go(int k); int un(string& s, int& ptr) { if (s[ptr] == ( ) { ptr++; int r = add(s, ptr); if (r & 2) r ^= 2; ...
// bsg_rp_clk_gen_coarse_delay_element // // o contains controllably delayed signal // // module bsg_clk_gen_coarse_delay_element #(parameter `BSG_INV_PARAM(start_tap_p)) // module bsg_rp_clk_gen_atomic_delay_tuner (input i , input sel_i , input we_async_i , input we_inited_i // basically says we...
#include <bits/stdc++.h> using namespace std; class Edge { public: int neighbour; int edge_number; int weight; Edge(int neigh, int edge_no, int weig) { neighbour = neigh; edge_number = edge_no; weight = weig; } }; int main() { int n, m; cin >> n >> m; vector<...
#include <bits/stdc++.h> const int32_t MAX_N = 1000; bool isInA[MAX_N + 5], isInB[MAX_N + 5], isVisited[MAX_N + 5]; std::vector<int32_t> v[MAX_N + 5]; int32_t Dfs(int32_t nd) { isVisited[nd] = true; if (isInA[nd]) { return nd; } int32_t ans = INT32_MAX; for (auto &x : v[nd]) { if...
/* Execute Module (64-bit, Combined) */ `include "ExOp64_3A.v" `include "ExOp64_3B.v" module ExOp64_3C( /* verilator lint_off UNUSED */ clock, reset, opStepPc, idInGenPc, regOutOK, regIdRs1, regValRs1, regIdRt1, regValRt1, regIdRn1, regValRn1, regIdRw1, regValRw1, immValRi1, opCmd1, regIdRs2, regValRs2, regI...
/** * 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::sync_with_stdio(0); long long a, b, c; cin >> a >> b >> c; if (a > b) swap(a, b); cout << a + min(c, a + b) + min(b, a + c); return 0; }
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2007 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); input clk; reg toggle; integer cyc; initial cyc=1; wire [7:0] cyc_copy = cyc[7:0]; always @...
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1.0); const double EPS = 1e-6; const long long oo = 1LL << 60; const int INF = 0x3f3f3f3f; const int MOD = 1e9 + 7; const int N = 100005; struct segTree { int num; long long sum[5]; } node[N << 2]; struct Query { int t...
// NeoGeo logic definition (simulation only) // Copyright (C) 2018 Sean Gonsalves // // 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, either version 3 of the License, or // (at your option) an...
// file: clk_wiz_v3_6.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 disclaimer is not...
#include <bits/stdc++.h> using namespace std; int n; int get(int x) { int t = log2(x); if ((1 << t) < x) t++; return (1 << t) - x; } unordered_map<int, int> to, pos; unordered_map<int, vector<pair<pair<int, int>, int> > > mp; int a[200005]; pair<pair<int, int>, int> num[200005]; int len = ...
/** * 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 rd_memory ( remapping_memory, full, rd_data, rd_clk, rd_en, rd_addr, reset ); /* Parameters */ parameter RD_DATA_WIDTH = 1; parameter RD_ADDR_WIDTH = 2; parameter MEM_DEPTH = 4; /* Ports */ ...
#include <bits/stdc++.h> inline long long read() { long long x = 0; char ch = getchar(), w = 1; while (ch < 0 || ch > 9 ) { if (ch == - ) w = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = x * 10 + ch - 0 ; ch = getchar(); } return x * w; } void...
#include <bits/stdc++.h> using namespace std; int d[(1 << 17) + 20][100], par[(1 << 17) + 20][100]; int prime[20] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53}; int sum[70], a[100]; int ret, temp; int ans = 10000000; void pre() { for (int i = 1; i < 59; i++) { for (int j = 0; j ...
// EE 471 Lab 1, Beck Pang, Spring 2015 // Main function for calling different counter onto the board // @require: only call one counter a time module DE1_SoC (CLOCK_50, LEDR, SW, KEY); input CLOCK_50; // connect to system 50 MHz clock output reg [9:0] LEDR; input [9:0] SW; input [3:0] KEY; wire clk; ...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) const int inf = 0x3f3f3f3f; const long long LL_INF = 0x3f3f3f3f3f3f3f3f; template <typename T> T gcd(T a, T b) { if (a == 0) return b; return gcd(b % a, a); } long long power(long long a, long long b, long long m = 1000000007) { long long ans...
(** * Maps: Total and Partial Maps *) (** Maps (or dictionaries) are ubiquitous data structures both generally and in the theory of programming languages in particular; we're going to need them in many places in the coming chapters. They also make a nice case study using ideas we've seen in previous c...
// // Copyright 2012 Ettus Research LLC // // 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, either version 3 of the License, or // (at your option) any later version. // // This program is dis...
/** * 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: 2016.2 // Copyright (C) 1986-2016 Xilinx, Inc. All Rights Reserved. // // ============================================================== `timescale 1ns/1ps ...
#include <bits/stdc++.h> using namespace std; int x[100] = {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, ...
#include <bits/stdc++.h> using namespace std; const long long oo = 1e18; const long long MAXN = 110; long long N; vector<string> query(long long a, long long b) { cout << ? << << a << << b << n ; fflush(stdout); long long sz = b - a + 1; vector<string> vect; for (long ...
/** * 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...
// -- (c) Copyright 2010 - 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...
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ; long long n, d; cin >> n >> d; pair<long long, long long> s[n]; deque<long long> p; long long ind, cnt = 1; for (long long i = 0; i < n; i++) { cin...
#include <bits/stdc++.h> using namespace std; int main() { int n, x0; cin >> n >> x0; int x = x0; int a[n][2]; for (int i = 0; i < n; i++) cin >> a[i][0] >> a[i][1]; int c = 0, d = 0; for (int i = 0; i < n; i++) { if (min(a[i][0], a[i][1]) > x) { x = min(a[i][0], a[i][1]); ...
#include <bits/stdc++.h> using namespace std; int main() { int n; int a[100005]; cin >> n; int fa = 1; for (int i = 1; i <= n; i++) { cin >> a[i]; if (a[i] != i) { fa = 0; } } if (fa == 1) { cout << 0 ; } else { int ji = n - 1; while (a[ji...
/** * 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 main(x,y,p); input [7:0] x,y; output [15:0] p; wire [6:0] ip1; wire [7:0] ip2,ip3,ip4,ip5,ip6,ip7,ip8,si,iip; wire [6:0] s1,s2,s3,s4,s5,s6; wire [7:0] c1,c2,c3,c4,c5,c6,c7; wire c; // first AND array and fi1(p[0],y[0],x[0]); and fi2(ip1[0],y[0],x[1]); and fi3(ip1[1],y[0],x[2]); and fi4(ip1[2],y[0],x[3]); and fi5...
#include <bits/stdc++.h> using namespace std; vector<long long int> xi; vector<long long int> hi; int main() { long long int n, x, h, ans = 1, temp, temp1, curr, i; scanf( %lld , &n); for (i = 0; i < n; i++) { scanf( %lld %lld , &x, &h); xi.push_back(x); hi.push_back(h); } ...
/* * Copyright (c) 2014, Olof Kindgren <> * All rights reserved. * * Redistribution and use in source and non-source forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this lis...
// megafunction wizard: %ALTECC% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altecc_encoder // ============================================================ // File Name: alt_ddrx_encoder_40.v // Megafunction Name(s): // altecc_encoder // // Simulation Library Files(s): // // ==========================...
// Copyright 2020-2022 F4PGA 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 // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
#include <bits/stdc++.h> using namespace std; int n, i; double am, vm2, d, tant, ti, vm, t, s, daux, tfin; int main() { scanf( %d %lf %lf , &n, &am, &d); tant = 0; for (i = 0; i < n; i++) { scanf( %lf %lf , &ti, &vm); t = (vm / am); s = 0.5 * (vm * vm / am); daux = d - s; ...
#include <bits/stdc++.h> using namespace std; int main() { int T; cin >> T; for (int i = 0; i < T; i++) { int N; cin >> N; vector<int> vec(N); for (int j = 0; j < N; j++) { cin >> vec.at(j); } if (vec.at(0) + vec.at(1) <= vec.at(N - 1)) { cout << 1 << ...
#include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i = (a); i < b; ++i) #define rrep(i,a,b) for(int i = (b); i --> (a);) #define trav(x, v) for(auto &x : v) #define all(v) (v).begin(),(v).end() #define sz(v) (int)(v).size() bool que_big(int s, string x){ cout << s+1 << << x...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 18:49:08 02/22/2015 // Design Name: // Module Name: NormaliseProdMult // Project Name: // Target Devices: // Tool versions: // Description: // ...
/** * 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 file is owned and controlled by Xilinx and must be used * * solely for design, simulation, implementation and creation of * * design files limited to Xilinx devices or technologies. Use ...
#include <bits/stdc++.h> using namespace std; int n, a[101], nxt, l, h; int main(int argc, const char* argv[]) { scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %d , &a[i]); } int mn = 10001; for (int i = 0; i < n; i++) { nxt = i + 1; nxt %= n; if (mn > abs(a[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...
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s; for (int i = s.length() - 1; i >= 0; i--) { if (t == ) { t.push_back(s[i]); } else if (t.back() <= s[i]) { t.push_back(s[i]); } } reverse(t.begin(), t.end()); 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...
`default_nettype none //All DFF* have INIT, but the hardware is always initialised to the reset //value regardless. The parameter is ignored. // DFFN D Flip-Flop with Negative-Edge Clock module \$_DFF_N_ (input D, C, output Q); DFFN _TECHMAP_REPLACE_ (.D(D), .Q(Q), .CLK(C)); wire _TECHMAP_REMOVEINIT_Q_ = 1; endmo...
// verilog mode bug1346 testcase module design(/*AUTOARG*/ // Outputs y10, y11, y12, y13, y14, y15, y16, y17, y18, y19, y20, y21, y22, y23, y24, y25, y26, y27, y30, y31, y32, y33, y34, y35, y36, y40, y41, y42, y43, y44, y45, // Inputs i0, i1 ...
#include <bits/stdc++.h> using namespace std; int main() { vector<int> v, v1; char a[8][8]; for (int i = 0; i < 8; i++) for (int j = 0; j < 8; j++) cin >> a[i][j]; for (int i = 0; i < 8; i++) for (int j = 0; j < 8; j++) { if (a[i][j] == B ) { int b = 0; bool ...
/* Copyright (c) 2016-2018 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, distri...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 7; const int MOD = 1e9 + 7; const int dx[4] = {0, 0, -1, 1}; const int dy[4] = {-1, 1, 0, 0}; const int N = 1e5 + 1; int n; long long a[N], s[N], p[N], k; int ans = INF; bool Check(int val) { long long ans = k + 1; for (int ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); int tc; cin >> tc; while (tc--) { int n; cin >> n >> ws; string str; cin >> str; int flag = 0, i; for (i = 0; i < str.size() - 1; i++) { ...
#include <bits/stdc++.h> using namespace std; int main() { long long int MOD = 998244353; long long int n; cin >> n; pair<long long int, long long int> arr[n]; for (long long int i = 0; i < n; ++i) cin >> arr[i].first >> arr[i].second; long long int fact[n + 1]; fact[0] = 1; for (lon...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; cout << (regex_match(s, regex( (1|14|144)* )) ? YES : NO ); }
/* * 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> #include <iostream> #define ll long long using namespace std; const long long mod=998244353; const long long mod2=1ll<<32; const double pi = 2 * acos(0.0); const ll N=200001; bool compare(pair<int,int> quan1,pair<int,int> quan2) { return quan1.second <quan2.s...
module top(input count, count_sw, thresh_sw, output gtu, gts, ltu, lts, geu, ges, leu, les, zero, max, output gtu_n, gts_n, ltu_n, lts_n, geu_n, ges_n, leu_n, les_n, zero_n, max_n ); reg [31:0] threshold = 32'b0; reg [31:0] threshold_down = 32'b0; reg [31:0] counter = 32'b0; reg [31:0] counter_d...
// (C) 1992-2015 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> int a[201][3]; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, k; cin >> n >> k; vector<string> a; for (int i = 0; i < n; i++) { string r; cin >> r; a.push_back(r); } int count = 0, ans = 0; fo...
#include <bits/stdc++.h> using namespace std; bool prime[1007]; int n; void sieve() { for (int i = 4; i <= 1005; i += 2) prime[i] = false, prime[i - 1] = true; prime[2] = true; for (int i = 3; i <= 1000; i += 2) { if (prime[i]) { for (int j = i * i; j <= 1005; j += i * 2) prime[j] = fa...
#include <bits/stdc++.h> using namespace std; struct type { int a, b; } b[17]; int p[17]; int a[17]; int ans[101]; bitset<2001> f[65536]; int n, K, L, i, j, k, l, sum, len, s, tot; bool cmp(type a, type b) { return a.b > b.b; } int main() { p[1] = 1; for (i = 2; i <= 16; i++) p[i] = p[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; string a, b; int k; int main() { cin >> a; k = 1; if (a.size() % 2 == 0) { while (k != a.size() + 1) { if (k % 2 != 0) { b += a[a.size() - k / 2 - 1]; } else { b += a[k / 2 - 1]; } k++; } ...
//------------------------------------------------------------------- //-- tristate1_tb.v //-- Banco de pruebas para la puerta tri-estado //------------------------------------------------------------------- //-- BQ November 2015. Written by Juan Gonzalez (Obijuan) //----------------------------------------------------...
#include <bits/stdc++.h> using namespace std; const int inf = 1000000007; const long long linf = 1LL << 62; const unsigned long long ulinf = 1ULL << 63; const double eps = 0.000001; const double pi = 3.14159265358979323846; template <class T> T abs(T a) { return a >= 0 ? a : -a; } template <clas...
#include <bits/stdc++.h> const int N = 200020; int _, n, m, x, y, flag, a[N], c[N], d[N]; std::queue<int> q; std::pair<int, int> b[N]; std::vector<int> g[N], ans; void f(int u) { if (++a[u] > g[u].size() && !c[u]) q.push(u), c[u] = 1; } int main() { scanf( %d%d , &n, &m); for (int i = 1; i <...
#include <bits/stdc++.h> using namespace std; char vis[305][305]; int main() { int n; cin >> n; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; char c; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cin >> vis[i][j]; } } for (int k = 0; k...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2019 by Todd Strader. // SPDX-License-Identifier: CC0-1.0 // Test for trace file interface aliasing typedef struct packed { integer val100; integer val200; } struct_t; ...
#include <bits/stdc++.h> using namespace std; int main() { string x, y; cin >> x >> y; for (long long int i = 0; i < x.size(); i++) { if (x[i] == y[i]) cout << 0; else cout << 1; } }
#include <bits/stdc++.h> using namespace std; const int inf = 1e9; int main() { int n, d, h; cin >> n >> d >> h; if (h * 2 < d || h > n || d > n || h > d || n < d + 1 || (h == 1 && d == 1 && (n != 2))) cout << -1; else { if (h == 1) { for (int i = 2; i <= n; i++) cout <...
#include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; using ll = long long; const int N = 3e3 + 3; int a[N][N]; pii sum[N]; int main() { ios_base::sync_with_stdio(false); int n, m; cin >> n >> m; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) cin >> a[i...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 10:23:10 01/08/2015 // Design Name: Top_N3_Computer_IOBUS_VGA_PS2 // Module Name: E:/Study/PentiumX/Hardware/PentiumX_OnSoC/test_Top.v // Project Name: PentiumX_OnSo...
#include <bits/stdc++.h> using namespace std; pair<int, int> p; void sort() { int temp = 0; if (p.first < p.second) { temp = p.first; p.first = p.second; p.second = temp; } } int main() { int n; cin >> n; for (int i = 0; i < n; i++) { int op = 0; cin >> p....
#include <bits/stdc++.h> using namespace std; int T, N, P, ap[109][109]; int main() { scanf( %d , &T); while (T--) { scanf( %d %d , &N, &P), P += 2 * N; for (int df = 1; df < N && P; df++) for (int i = 0; i < N && P; i++) ap[i][(i + df) % N] = 1, P--; for (int i = 0; i < N; 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; long long int arr[105]; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long int n, x, y, t, l, m, k = 0, r = 0, a, b, c, d, p = 0, q = 0, s, i, j, ans = 0, ans1 = 0; string s1; ...
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // This file is part of the M32632 project // http://opencores.org/project,m32632 // // Filename: STEUERUNG.v // Version: 1.0 // Date: 30 May 2015 // // Copyright (C) 2015 Udo Moeller // // This sour...
#include <bits/stdc++.h> using namespace std; void solve() { int n, q, m; cin >> n >> q >> m; vector<int> b(n + 1), a(m + 1); for (int i = 1; i <= n; i++) cin >> b[i]; int t[q], l[q], r[q]; for (int i = 0; i < q; i++) cin >> t[i] >> l[i] >> r[i]; for (int i = 1; i <= m; i++) { cin ...
/** * 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...
// (C) 2001-2016 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 simulation // files), and any associated doc...
#include <bits/stdc++.h> using namespace std; template <typename T1, typename T2> istream& operator>>(istream& in, pair<T1, T2>& a) { in >> a.first >> a.second; return in; } template <typename T1, typename T2> ostream& operator<<(ostream& out, pair<T1, T2> a) { out << a.first << << a.second;...
// (C) 1992-2012 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...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of ent_a // // Generated // by: wig // on: Tue Jun 27 05:12:12 2006 // cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../verilog.xls // // !!! Do not edit this file! Autogenerated by MIX !!! // $Author: wi...
#include <bits/stdc++.h> using namespace std; int pai[1000010]; int find(int x) { if (pai[x] == x) return x; return pai[x] = find(pai[x]); } void join(int a, int b) { pai[find(a)] = find(b); } int main() { int n, m, q; cin >> n >> m >> q; for (int i = 1; i <= n + m; i++) pai[i] = i; ...
#include <bits/stdc++.h> using namespace std; set<int> s; const int MAX = 150000; int t[MAX]; int main() { int n, q, k; cin >> n >> k >> q; for (int i = 0; i < n; i++) scanf( %d , t + i); for (int i = 0; i < q; i++) { int query; scanf( %d , &query); int x; scanf( %d , &...
#include <bits/stdc++.h> using namespace std; long long f[10]; void ge() { f[0] = 1; for (int i = 1; i <= 9; i++) { f[i] = f[i - 1] * 10; } } long long a[100005], b[100005]; int main() { ge(); int n, k; long long ans = 1; int i, j; scanf( %d%d , &n, &k); for (i = 0;...
#include <bits/stdc++.h> using namespace std; void solve() { int n, c0, c1, h; cin >> n >> c0 >> c1 >> h; string s; cin >> s; int ans = 0; for (char ch : s) { if (ch == 0 ) { ans += min(c0, c1 + h); } else { ans += min(c1, c0 + h); } } cout << ans <...
#include <bits/stdc++.h> int atob(int t, int a, int b) { int ret = 0, p = 1; while (t) { ret += t % b * p; p *= a; t /= b; } return ret; } int maxbit(int t) { int ret = t % 10; while (t) { if (ret < t % 10) ret = t % 10; t /= 10; } return ret; } in...
#include <bits/stdc++.h> using namespace std; int A[500][500]; int B[500][500]; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n, m; cin >> n >> m; for (int i = 0; i < n; ++i) for (int j = 0; j < m; ++j) cin >> A[i][j]; int mx = -1e9; for (int i = 0; i < n; ++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; const int N = 2e5 + 10; int n, k; char s[N]; int chk(char s[]) { for (int i = 1; i <= n; i += k) { for (int j = 1; j <= k; j++) { if (i + j - 1 > n || i + j - 1 + k > n) break; if (s[i + j - 1] != s[i + j - 1 + k]) { if (s[i + j...
// MBT 8-18-2014 // // BSG Assembler Out (Ring --> Assembler) // // prefer ready_o to yumi_o // prefer yumi_i to ready_i // // // takes a single wide channel and strict round-robin // distributes it across a number of input channels. // // most of the heavy lifting is done by // bsg_round_robin_fifo_to_fifo. this modul...
// megafunction wizard: %ALTCLKCTRL% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altclkctrl // ============================================================ // File Name: PH2_CLK.v // Megafunction Name(s): // altclkctrl // // Simulation Library Files(s): // cycloneii // =====================...
#include <bits/stdc++.h> using namespace std; bool matrix[2005][2005]; int main() { ios::sync_with_stdio(false); int n, m, k; cin >> n >> m >> k; string s; getline(cin, s); for (int y = 0; y < n; y++) { getline(cin, s); for (int x = 0; x < m; x++) matrix[x][y] = s[x] == . ; ...
module lcd ( input wire clk, output reg [4:0] ctl, output reg [7:0] data ); localparam RW = 0; localparam RS = 1; localparam ON = 2; localparam EN = 3; localparam BLON = 4; localparam INITIAL = 0; localparam LINE1 = 5; localparam CHLINE = LINE1 + 16; localparam LINE2 = CHLINE + 1; local...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; ++i) cin >> a[i]; sort(a.begin(), a.end()); int ans = a.back() - a[0]; int eachCanRemove = (n - 2) / 2; for (int i = 0...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Mon Feb 13 12:45:00 2017 // Host : WK117 running 64-bit major release (build ...