text
stringlengths
59
71.4k
module top; reg [15:0] out_16; reg [31:0] in_32, in_32x, out_32, out_32x; reg [63:0] out_64; integer res, fd; reg passed; initial begin passed = 1'b1; // Check that a normal 32 bit %z works as expected. fd = $fopen("work/test_fscanf.bin", "wb"); in_32 = 32'b000x100z_001z000x_101xxxzz_100z1...
/** * 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, k, a[10010]; bool vs[3000][3000]; int main() { cin >> n >> k; for (int i = n + 1; i <= n + k; i++) { a[i] = i - n; } for (int i = 1; i <= n; i++) a[i] = i; for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= i + k; j++) { ...
/// date :2016/3/3 /// engineer :ZhaiShaoMin /// module name: data path of FSM_upload_flit /// module function : combination of needed state elment,which are controled by FSM_upload_flit module upload_datapath(// input clk, rst, clr_max, ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1000000 + 10; char b[maxn]; int a[maxn]; int ccc[20]; int main() { long long n; long long sum = 0; cin >> n; if (n % 2 == 0) sum = n / 2; else sum = (-n - 1) / 2; cout << sum << endl; return 0; }
`timescale 1ns / 1ps /* * File : uart-min.v * Creator(s) : Grant Ayers () * * Modification History: * Rev Date Initials Description of Change * 1.0 24-May-2010 GEA Initial design. * * Standards/Formatting: * Verilog 2001, 4 soft tab, wide column. * * Descriptio...
/** * 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> const long long inf = std::numeric_limits<long long>::max(); const int infint = std::numeric_limits<int>::max(); const long long mod = 1e9 + 7; using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); vector<int> g[500100]; long long a[500100]; l...
#include <bits/stdc++.h> using namespace std; int arr[500005], brr[500005]; pair<int, int> tree[500005 * 4]; vector<int> vv[500005]; vector<pair<int, int> > qr[500005]; int ans[500005]; void build(int node, int b, int e) { if (b == e) { tree[node] = make_pair(500000000, 500000000); return;...
// nios_system_mm_interconnect_0_avalon_st_adapter.v // This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes // will probably be lost. // // Generated using ACDS version 15.1 189 `timescale 1 ps / 1 ps module nios_system_mm_interconnect_0_avalon_st_adapter #( parameter in...
/* Copyright 2018 Nuclei System Technology, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except i...
#include<bits/stdc++.h> #define ll long long #define ld long double #define ff first #define ss second #define eb emplace_back #define pb push_back #define mp make_pair #define all(x) begin(x), end(x) #define endl n int dx[4] = {1, -1, 0, 0}; int dy[4] = {0, 0, -1, 1}; // ll dp[100005]; ...
//***************************************************************************** // (c) Copyright 2009 - 2012 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 /...
// Copyright (c) 2014 CERN // Maciej Suminski <> // // 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) // any late...
/** * 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...
// megafunction wizard: %ROM: 1-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: stage3.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // =================================...
#include <bits/stdc++.h> using namespace std; int read() { int q = 0; char ch = ; while (ch < 0 || ch > 9 ) ch = getchar(); while (ch >= 0 && ch <= 9 ) q = q * 10 + ch - 0 , ch = getchar(); return q; } const int N = 100005; double P[N][110], ans; int n, m, a[N], b[N]; double ...
/** * 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> int main() { int N, A, B, C; char Error = 0; scanf( %d , &N); while (N) { A = N % 10; B = N % 100; C = N % 1000; if (A == 1) { N /= 10; } else if (B == 14) { N /= 100; } else if (C == 144) { N /= 1000; } else { ...
// // Copyright (c) 2000 Steve 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) // a...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000007; const int N = 1000010; template <class T> class BIT { T bit[N + 1]; int n; public: BIT() { n = N; memset(bit, 0, sizeof(bit)); } T sum(int i) { T s = 0; ++i; while (i > 0) { ...
// (c) Copyright 1995-2017 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 license and does not grant ...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; template <class T, class U> inline void add_self(T &a, U b) { a += b; if (a >= mod) a -= mod; if (a < 0) a += mod; } template <class T, class U> inline void min_self(T &x, U y) { if (y < x) x = y; } template <class ...
#include <bits/stdc++.h> using namespace std; int n, m; int mp[500][500]; int rSum[500][500], cSum[500][500]; int dSumF[500][500], dSumB[500][500]; int blacks(int r1, int c1, int r2, int c2) { int ans = 1; if (r1 == r2 && c1 == c2) { ans = 1; } else if (r1 == r2) { if (c2 > c1) { ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 14:11:30 08/20/2015 // Design Name: // Module Name: Sixth_Phase // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: /...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: dcfifo // ============================================================ // File Name: ff_80x32_fwft_async.v // Megafunction Name(s): // dcfifo // // Simulation Library Files(s): // altera_mf // ===================================...
#include <bits/stdc++.h> using namespace std; long long xorsum(long long n, long long k) { if (k == 1) return n; int msb = (int)log2((double)n); if ((1ll << msb) > n) msb--; return (2ll << msb) - 1; } int main() { long long n, k; cin >> n >> k; cout << xorsum(n, k) << endl; retur...
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; template <int mod> struct ModInt { int x; ModInt() : x(0) {} ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {} ModInt &operator+=(const ModInt &p) { if ((x += p.x) >= mod) x -= mod; return *thi...
//----------------------------------------------------------------------------- //-- Baudrate generator //-- It generates a square signal, with a frequency for communicating at //-- the given //-- given baudrate //-- The output is set to 1 only during one clock cycle. The rest of the //-- time is 0 //------------------...
#include <bits/stdc++.h> using namespace std; void bfs(long long root, list<long long> adj[], vector<long long> &level) { level[root] = 0; queue<long long> qu; qu.push(root); while (!qu.empty()) { long long cur = qu.front(); qu.pop(); for (auto it : adj[cur]) { if (level[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 law...
//Legal Notice: (C)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 //simulation files), and any associate...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; int n, m, fa[N], f[N], d[N], head[N], xx, yy, ww, fr[N]; int ans; bool in[N], c[N]; struct nd { int x, y, w, id; } a[N]; bool operator<(nd a, nd b) { return a.w < b.w || (a.w == b.w && a.id < b.id); } struct ndd { int ne, to,...
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /stack:200000000 ) int t, n, m, j, ans, k, a, b, c, d, e, f, sum, i, sz, row, col, l; string s, s2, s3, s4; deque<pair<int, int> > v; void brainfuck(); int main() { ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(N...
#include <bits/stdc++.h> using namespace std; int main() { int a[100010]; int b[100010]; while (scanf( %d , &a[0]) != EOF) { getchar(); int n = 1; while (scanf( %d , &a[n]) != EOF) { n++; getchar(); } sort(a, a + n); a[n] = 9999999; int h = 0; ...
module Section5_Top( input DigitalLDir, input DigitalRDir, input reset_n, output [3:0] outputs /*output Len, output Ldir, output Ren, output Rdir */ ); wire clk; //used for the oscillator's 2.08 MHz clock wire clk_2; //used for slowed down, 5 Hz clock //This is an instance of a special, bu...
/** * 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 inf = 1e9 + 5; const long long infll = 1e18 + 5ll; const long double eps = 1e-9; const int maxn = 1e5 + 100; const long long maxlog = 21; const int P = 97; const int mod = 1e9 + 9; int n, m, lvl[maxn], up[maxlog][maxn], sub[maxn], par[maxn], ans[...
#include<bits/stdc++.h> #define int long long using namespace std; const int mod=1e9+7; const int N=3e5+100; int fa[N]; //并查集,表示i的祖父fa[i] int begi; //记录可以随意放的点的位置(只有一个) int n,m; int a[N],b[N],c[N],in[N],ans[N]; //a[i]和b[i]表示i必须在a[i]的左边,b[i]的右边 //c[i]表示在缩成一个点的一段中的开头(b[i]的限制中能无限制的放位置) //in[i]表示入...
#include <bits/stdc++.h> using namespace std; const int oo = 0x3f3f3f3f; const long long ooo = 9223372036854775807ll; const int _cnt = 1000 * 1000 + 7; const int _p = 1000 * 1000 * 1000 + 7; const int N = 1001005; const double PI = acos(-1.0); const double eps = 1e-9; int o(int x) { return x % _p; } ...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of inst_a_e // // Generated // by: wig // on: Mon Jun 26 08:31:57 2006 // cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../../generic.xls // // !!! Do not edit this file! Autogenerated by MIX !!! // $Auth...
module top ( input wire i_clk, input wire i_rst, input wire i_ce, input wire i_d1, input wire i_d2, output wire [23:0] io, ); // BUFGs wire clk; BUFG bufg_1 (.I(i_clk), .O(clk)); genvar sa, e, i, sr; generate begin // SRTYPE for (sa=0; sa<2; sa=sa...
#include <bits/stdc++.h> int cmpfunc(const void* a, const void* b) { return (*(int*)a - *(int*)b); } int main() { int t, x, i, j, c; scanf( %d , &t); while (t--) { char n[101]; int m[101]; scanf( %s , &n); x = strlen(n); j = 0; c = 0; for (i = 0; i < x; i++) { ...
#include <bits/stdc++.h> using namespace std; int main() { int i, test, n, m, value; cin >> test; while (test--) { int s = 0; cin >> n >> m; for (i = 1; i <= n; i++) { cin >> value; s += value; } if (s == m) { printf( YES n ); } else { ...
#include <bits/stdc++.h> using namespace std; int main() { int t; t = 1; for (int r = 0; r < t; r++) { long long n, m, i, x, y, z, sum = 0; cin >> n >> m; vector<string> v(51); char a = a , b = A ; for (i = 0; i <= 50; i++) { if (b > Z ) b = A ; v[i].pus...
#include <bits/stdc++.h> using namespace std; long long a[10][10]; int d[10], b[10]; long long kq; void dequy(int k) { int i; long long sum; if (k == 6) { sum = a[d[1]][d[2]] + a[d[2]][d[1]] + a[d[3]][d[4]] + a[d[4]][d[3]]; sum += a[d[2]][d[3]] + a[d[3]][d[2]] + a[d[4]][d[5]] + a[d[5]]...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; int m; cin >> n >> m; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); int ans = 0; for (int i = 0; i < m; i++) { ...
#include <bits/stdc++.h> using namespace std; char s[100003], ss[100003]; int main() { int ans = 0; scanf( %s , s + 1); int len = strlen(s + 1); int n = 0; for (int i = 1; i <= len; i++) { if (n > 0 && ss[n] == s[i]) { n--; ans++; } else ss[++n] = s[i]; ...
#include <bits/stdc++.h> using namespace std; const int inf = 1000000007; const long double eps = 1e-9; const long double pi = 3.141592653589793; const long double e = 2.718281828459045; int dp[100005], h[100005]; int n, mmm; int main() { memset(dp, -1, sizeof(dp)); memset(h, 0, sizeof(h)); ...
#include <bits/stdc++.h> using namespace std; const int maxn = 5e5; int a[maxn], b[maxn], c[maxn]; int n, K, i, j, x, y, bl, la; int main() { scanf( %d%d , &n, &K); x = K; for (i = 2; i <= x; i++) if (x % i == 0) { a[++la] = i; while (x % i == 0) { b[la]++; ...
/* Copyright (c) 2014-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; int arr[100010]; int sieve[100010]; int main() { int n, i, j, m, x, a, b, ans, q, flag = 0, cnt = 0; scanf( %d , &n); for (i = 2; i <= n; i++) { if (!sieve[i]) { for (j = i * i; j <= n; j += i) sieve[j] = 1; for (j = i; j <= n; j = ...
//***************************************************************************** // (c) Copyright 2009 - 2010 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 INF = 1 << 30; unsigned long long n, k, x; unsigned long long a[300000]; unsigned long long dpL[300000]; unsigned long long dpR[300000]; int main() { int i, j; cin >> n >> k >> x; unsigned long long s = 0, MAX = 0; for (i = 0; i < n; ...
#include <bits/stdc++.h> using namespace std; int N, K; int tosum; int begin1 = 1000000001, end1; map<int, pair<int, int> > m; vector<pair<int, int> > v; int main() { if (fopen( cf612d.in , r )) { freopen( cf612d.in , r , stdin); freopen( cf612d.out , w , stdout); } scanf( %d %d...
#include <bits/stdc++.h> using namespace std; const int dx[4] = {0, 1, -1, 0}, dy[4] = {-1, 0, 0, 1}; int n, m; char g[60][60]; bool col[60][60][2][4]; bool tmp[60][60][2][4]; bool inrange(int x, int y) { return x >= 0 && x < n && y >= 0 && y < m; } void solve(int x, int y, int turn, int dir) { int ...
#include <bits/stdc++.h> using namespace std; struct Edge { int v, next; } edge[2050]; int e, ft[2050]; int a, n, m; bool rain[2050]; int x[2050], p[2050]; long long dp[2050][2050]; long long opt[2050]; int main() { int l, r; while (cin >> a >> n >> m) { e = 0; for (int i = 0...
#include <bits/stdc++.h> using namespace std; long long mod = 1000000007LL; long long base = 10000007; long long large = 1000000000000000000LL; class UnionFind { private: vector<int> p, rank; public: UnionFind(int n) { rank.assign(n, 0); p.assign(n, 0); for (int i = 0; i < n...
`default_nettype none module execute_jump( input wire iCLOCK, input wire inRESET, input wire iRESET_SYNC, //Event CTRL input wire iEVENT_HOLD, input wire iEVENT_START, input wire iEVENT_IRQ_FRONT2BACK, input wire iEVENT_IRQ_BACK2FRONT, input wire iEVENT_END, //State input wire iSTATE_NORMAL, ...
/** * 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> namespace std { template <typename...> using void_t = void; } template <typename T, typename _ = void> struct is_container : std::false_type {}; template <typename... Ts> struct is_container_helper {}; template <typename T> struct is_container< T, typename std::conditi...
/* * 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 law...
// DESCRIPTION: Verilator: Verilog Test module // // A test that a package import declaration can preceed a parameter port list // in an interface declaration. See 25.3 of the 1800-2017 LRM. // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2013 by Jeremy Bennett. // SPDX-License-...
#include <bits/stdc++.h> using namespace std; constexpr int MAXN = 200000; int x[MAXN + 2]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) cin >> x[i]; sort(x, x + n); int ans = INT_MAX; for (int i = 0; i < n / 2; i++) ans = min(ans, x[i + n / 2] - x[i]); cout << ans << en...
#include <bits/stdc++.h> using namespace std; #pragma GCC diagnostic warning -Wall int main() { int n; scanf( %d , &n); vector<vector<int> > sec(n); for (typeof(n) i = (0); i < (n); i++) { int k; scanf( %d , &k); sec[i].resize(k); for (typeof(k) j = (0); j < (k); j++) sca...
#include <bits/stdc++.h> using namespace std; long long n, x, k, lb, ub, ans = -1; int main() { long long l, r; scanf( %lld%lld%lld%lld , &n, &l, &r, &k); x = (r >= l ? r - l + 1 : r + n - l + 1) % n; for (long long i = k, j, r; i; i = j) { j = k / (k / i + 1); r = k / i; ub = mi...
// megafunction wizard: %LPM_FF% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: lpm_ff // ============================================================ // File Name: gl_dff5er.v // Megafunction Name(s): // lpm_ff // // Simulation Library Files(s): // lpm // =================================================...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-8; const double pi = acos(-1.0); const int INF = 0x3f3f3f3f; const int mod = 1e9 + 7; long long powmod(long long a, long long b) { long long res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1) res = res ...
/** * 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, b, i, p = 2e9; int main() { for (cin >> n; i < n; i++) { cin >> a >> b; if (max(a, b) <= p) p = max(a, b); else if (a <= p) p = a; else if (b <= p) p = b; else return cout << NO , 0; } ...
//Legal Notice: (C)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 //simulation files), and any associated do...
#include <bits/stdc++.h> using namespace std; vector<int> months = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; const int MAX = 1e5 + 55; const int inf = 1e9 + 77; const int MOD = 1e9 + 7; const double PI = acos(-1.0); const double eps = 1e-7; int main() { int n, k; scanf( %d , &n); ...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2010 Xilinx, Inc. // // 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 // //...
#include <bits/stdc++.h> using namespace std; int n, k; int p[55]; string t; void getp() { int j = 0; p[0] = p[1] = 0; for (int i = 1; i < t.length(); ++i) { while (j && t[j] != t[i]) j = p[j]; if (t[j] == t[i]) j++; p[i + 1] = j; } } void build() { getp(); string...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<long long> bs(n); for (auto &x : bs) cin >> x; if (count(bs.begin(), bs.end(), 0) == n) { cout << YES << endl; for (int _ = 0; _ < (n); ++_) cout << ...
#include <bits/stdc++.h> using namespace std; const int N = 2410; int n, l, r, a[N]; vector<int> p; tuple<int, int, int> tmp[2]; vector<tuple<int, int, int>> ans; int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> n; for (int i = 1, x; i <= 3 * n; i++) cin >> x, a[x] = 1; ...
#include <bits/stdc++.h> using namespace std; int n, m; pair<int, int> answer[404]; set<pair<int, int> > S; set<pair<int, int> >::iterator it, ii; bool check(pair<int, int> c) { ii = S.lower_bound(make_pair(c.first, 0)); if (ii != S.end()) { if (c.first + c.second > (*ii).first) return false; ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int ex[n], e[n]; int temp = n; int i = 0; while (temp--) { cin >> ex[i] >> e[i]; i++; } int sum = e[0], m = e[0]; for (int j = 1; j < n; j++) { sum = sum - ex[j] + e[j]; if (sum > ...
#include <bits/stdc++.h> using namespace std; const int maxn = 5e5 + 5; int main() { long long v, w1, w2, v1, v2; cin >> v >> w1 >> w2 >> v1 >> v2; long long x = max(v1, v2); if (x * x >= v) { if (v1 < v2) swap(v1, v2), swap(w1, w2); long long ans = 0; for (int i = 0; i <= v / v1...
/** * 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...
/* * 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) 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 = 200009; const long long MOD = 119 << 23 | 1; class { public: bool g[1 << 22]; int a[1 << 22]; int N, M, n, m; void solve() { int _; cin >> _; while (_--) { cin >> n >> m; N = (1 << n) - 1; ...
#include <bits/stdc++.h> using namespace std; double revs, a, b, c, d, C, totdist; const double pi = atan(1) * 4; int n, r, v, s, f; double distcovered(double t) { return max(r * (t + sin(t)), r * (t - sin(t))); } int main() { cout << fixed << setprecision(8); cin >> n >> r >> v; for (int c = 0;...
/* * File: top_pss.v * Project: pippo * Designer: kiss@pwrsemi * Mainteiner: kiss@pwrsemi * Checker: * Assigner: * Description: * top module for pippo sub-system, includes * pippo core, imc, dmc, icbu, dcbu * */ // synopsys translate_off `include "timescale.v" // syno...
#include <bits/stdc++.h> using namespace std; long long n, m, d; long long dp[150005][5]; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cin >> n >> m >> d; long long pt; long long prev, curr; for (long long i = 0; i < m; i++) { long long a,...
#include <bits/stdc++.h> #pragma comment(linker, /stack:67108864 ) using namespace std; template <class T> T abs(T a) { return (a) > 0 ? (a) : -(a); } template <class T> T sqr(T a) { return (a) * (a); } const long double PI = 3.1415926535897932, EPS = 1E-9; const int INF = 1000 * 1000 * 100...
/** * 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 long int N = 1e5 + 5; const long long int mod = 1e15 + 7; long long int dx[] = {1, -1, 0, 0}; long long int dy[] = {0, 0, 1, -1}; long long int y[N], yy[N], len[N]; long long int n, m, low, high, mid1, mid2; double ans = (double)mod; long long i...
`include "LookupTable.v" module CPU ( input clk, input rst, //input start input start, // External data memory interface . output [32-1:0] ext_mem_addr, input [256-1:0] ext_mem_data_i, output ext_mem_cs, output ext_mem_we, output [256-1:0] ext_mem_data_o, input ext_mem_ack ); /** *...
/* * Copyright (c) 2001 Stephan Boettcher <> * * 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 N = 2200000; int chk[N]; int main() { ios_base::sync_with_stdio(0); int cnt = 0, n, m; cin >> n >> m; for (int i = 0; i < n; i++) if (!chk[i]) { for (int j = i; (j < n && chk[j] < 2) || (j >= n && chk[n + n - 2 - ...
reg [width-1:0] last_test_expr; reg [width:0] temp_expr1; reg [width:0] temp_expr2; reg r_reset_n; reg fire_2state; wire fire_2state_comb; always @(last_test_expr or test_expr or `OVL_RESET_SIGNAL or r_reset_n)begin if(`OVL_RESET_SIGNAL == 1'b0 || r_reset_n)begin temp_expr1 = {(width+1){1'b0}}; te...
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2014.3.1 (lin64) Build Thu Oct 30 16:30:39 MDT 2014 // Date : Wed Apr 8 23:17:20 2015 // Host : parallella running 64-bit Ubuntu 14.04.2 ...
// -------------------------------------------------------------------- // Copyright (c) 2011 by Terasic Technologies Inc. // -------------------------------------------------------------------- // // Permission: // // Terasic grants permission to use and modify this code for use // in synthesis for all Terasic De...
/* * 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 2015 - 2017 Systems Group, ETH Zurich //-- //-- This hardware module 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 ...