text
stringlengths
59
71.4k
/****************************************************************************** * License Agreement * * * * Copyright (c) 1991-2013 Altera Corporation, San Jose, California, USA. * ...
#include <bits/stdc++.h> using namespace std; vector<int> sorted; vector<set<int> > v; set<int> solve(int lf, int rg) { if (lf == rg) { return v[lf]; } int md = (lf + rg) >> 1; set<int> x = solve(lf, md); set<int> y = solve(md + 1, rg); for (int val : y) { v[md + 1].insert(va...
#include <bits/stdc++.h> using namespace std; template <typename A, typename B> ostream& operator<<(ostream& os, const pair<A, B>& x) { return os << ( << x.first << , << x.second << ) ; } vector<int> E[505][505]; long long dp[505][505], W[505][505]; vector<pair<int, int>> verts[505][505], hors[50...
#include <bits/stdc++.h> using namespace std; const long long INF = 1000000000000000000ll; long long x[6], y[6]; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; for (int i = 0; i < n; i++) cin >> x[i] >> y[i]; if (n == 1) { cout << -1 << endl; return 0; } if (...
#include <bits/stdc++.h> using namespace std; map<int, int> glosy; map<pair<int, int>, int> parki; int main() { int n, m; scanf( %d%d , &n, &m); for (int i = (0); i < (n); i++) { int a, b; scanf( %d%d , &a, &b); if (a > b) swap(a, b); if (glosy.find(a) != glosy.end()) ...
#include <bits/stdc++.h> using namespace std; const int MAX = int(5e3); const int MOD = int(1e9 + 7); const int oo = INT_MAX; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, d, h; while (cin >> n >> d >> h) { if (2 * h < d) { cout << -1 << n ; ...
///////////////////////////// //LAB01 29/05 - Atividade 1// ///////////////////////////// module Mod_Teste( input CLOCK_27, input CLOCK_50, input [3:0] KEY, input [17:0] SW, output [6:0] HEX0, output [6:0] HEX1, output [6:0] HEX2, output [6:0] HEX3, output [6:0] HEX4, output [6:0] HEX5, outpu...
#include <bits/stdc++.h> using namespace std; typedef struct { int i; int j; } AXIS; AXIS D[] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}}; bool DFS(char maze[][505], AXIS S, int &k, int &n, int &m) { maze[S.i][S.j] = * ; for (int i = 0; i < 4; i++) { AXIS next; next.i = S.i + D[i].i; ...
module cbus_tb; `define ch1in_freq 0 `define ch2in_freq 1 `define ch3in_freq 2 `define ch4in_freq 3 `define ch1out_freq 4 `define ch2out_freq 5 `define ch3out_freq 6 `define ch4out_freq 7 `define rates 8 `define misc 9 task send_config_word; input [7:0] addr; input [31:0] data; integer i; ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 23:35:22 10/10/2013 // Design Name: // Module Name: mod_fsm_bola // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: ...
/** * 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; bool valid(long long num, long long den) { if (den == 0) { return num == 0; } else { return (num % den) == 0; } } long long gcd(long long a, long long b) { if (b == 0) { return a; } else { return gcd(b, a % b); } } ...
#include <bits/stdc++.h> using namespace std; const int oo = 1000000000; const double H = sqrt(3.0) * 0.5; const double eps = 1e-6; int main() { double r; scanf( %lf , &r); int i; long long ans = 0; for (i = 0; i <= r; i++) { double x = 1.5 * i + 1.0; if (x > r) break; do...
/** * 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...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000007; long long fact[200001], invfact[200001]; int n50 = 0, n100 = 0, k = 0; struct node { int l[2], r[2], b; }; long long nways[51][51][51][51][2], shortest[51][51][51][51][2]; queue<node> q; long long pmod(long long base, ...
/** * 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 = 100005, inf = 2e9, n = 100000; struct seg { int fl[N << 2], m1[N << 2], m2[N << 2], sz[N << 2], tg[N << 2], c[N << 2]; long long tr[N << 2]; void build(int k, int l, int r) { fl[k] = 0; m1[k] = inf; m2[k] = 0; sz[k] = ...
#include <bits/stdc++.h> using namespace std; const long long N = (long long)(1e6) + 322; const long long MAXN = (long long)(1e7) + 100; const long long inf = (long long)(3e18) + 322; const long long mod = (long long)(1e9) + 7; const double eps = 1e-6; inline void upd(long long &mn, long long x, long long...
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; string s[3003], t[3003]; long long hhs[3003][3003], hht[3003][3003], pp[3003], hhts[3003], hhtt[3003]; pair<int, int> cseg[3003]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); pp[0] = 1; for (int i = 1; i <...
#include <bits/stdc++.h> using namespace std; int n, m, Magic, md, pd; int a[99], b[99], cnt[99], row[99], col[99]; int t[99][99]; void giveans() { printf( %d n , Magic); for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) printf( %d%c , t[i][j], n [j + 1 == n]); exit(0); } void 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...
//wb_artemis_ddr3.v /* 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 rig...
#include <bits/stdc++.h> using namespace std; inline void read(int& n) { int x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) x = (x << 1) + (x << 3) + ch - 0 , ch = getchar(); n = x *...
#include <bits/stdc++.h> using namespace std; long long modPow(long long a, long long b); long long modInv(long long a); void solve() { long long n; cin >> n; long long a[n]; for (long long i = 0; i < n; i++) cin >> a[i]; long long dp[n + 1][n + 1]; memset(dp, 0, sizeof(dp)); long lo...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 21:50:01 07/20/2013 // Design Name: // Module Name: sha256 // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // ...
/* * Copyright (c) 2000 Philips Semiconductors * * This source code is free software; you can redistribute it * Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59...
#include <bits/stdc++.h> using LL = long long; using ULL = unsigned long long; using namespace std; long long n, m; vector<long long> a; vector<pair<long long, long long> > vec; signed main() { ios::sync_with_stdio(false), cin.tie(NULL); cin >> n; a.resize(n, 0); vec.resize(n, {0, 0}); ...
// (C) 2001-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 doc...
/** * 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 module HammingDecoderTest; reg [6:0] ReceivedHammingCode; wire [3:0] DecodedWord; wire [3:0] DecodedWord2; HammingDecoder DUT1 (ReceivedHammingCode, DecodedWord); NewHammingDecoder DUT2 (ReceivedHammingCode, DecodedWord2); wire [2:0] syndrome = DUT1.syndrome; initial begin ReceivedHammi...
#include <bits/stdc++.h> using namespace std; set<int> s[300000]; int ans[300000]; bool vis[300000]; int nr[500000]; int main() { int n, m; scanf( %d %d , &n, &m); priority_queue<pair<int, int> > pq; for (int i = 0; i <= 2 * m; i++) nr[i] = -1; for (int i = 0; i < n; i++) { int k, ...
/** * 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; struct point { int x, y; point(){}; point(int xx, int yy) { x = xx; y = yy; } point friend operator+(point a, point b) { return point(a.x + b.x, a.y + b.y); } point friend operator-(point a, point b) { return point(a.x...
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; const double PI = 4 * atan(1); const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3f; const int MOD = 1e9 + 7; const int MAX_N = 2e6 + 10; int n; int a[MAX_N], b[MAX_N], p[MAX_N]; void solve() ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 220000; const long long MOD = 1e9 + 7; int n; int was[MAXN * 2]; vector<int> beds[MAXN * 2]; int go[MAXN * 2]; int tm1; long long dfs1(int v) { was[v] = 1; long long ans = 1; for (int u : beds[v]) ans = (ans + dfs1(u)) % MOD; ...
#include <bits/stdc++.h> template <typename T> T gcd(T a, T b) { if (!b) return a; return gcd(b, a % b); } template <typename T> T lcm(T a, T b) { return a * b / gcd(a, b); } template <typename T> void chmin(T& a, T b) { a = (a > b) ? b : a; } template <typename T> void chmax(T& a,...
#include <bits/stdc++.h> using namespace std; template <typename T, typename S> ostream &operator<<(ostream &os, const pair<T, S> &p) { return os << ( << p.first << , << p.second << ) ; } template <typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_sam...
module maquina_4_estados(clock_50mhz, clock_1hz, segmentos, anodo,estado); input clock_50mhz; //entrada de oscilacion del cristal externo output clock_1hz; //clock 1 segundo output reg [6:0] segmentos = 7'b3F; //apagar segmentos output reg anodo = 0; //encender 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 law...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 15:55:15 05/29/2015 // Design Name: // Module Name: UART_IP // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // //...
`include "DC_define.v" `include "logfunc.h" `include "scmemc.vh" module DC_top_bank_tag //#(parameter Width=36, Size =256, Forward=0, REQ_BITS=7) //tag 10+counter 2+states 3 =15//29 bits virtual adress ( input clk ,input reset ,input ...
// $Id: c_matrix_arbiter.v 1625 2009-10-29 00:15:03Z dub $ /* Copyright (c) 2007-2009, Trustees of The Leland Stanford Junior University All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions ...
#include <bits/stdc++.h> using namespace std; template <typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; } template <typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; } template <typename T> inline bool smin(T &a, const T &b) { r...
#include <bits/stdc++.h> using namespace std; const long long INF = numeric_limits<int>::max(); const long long LINF = numeric_limits<long long>::max() / 2; const double DINF = numeric_limits<double>::max(); const int ITER = 3000; const double EPS = 1e-9; const int MAXN = 1005; struct addr { int x, ...
#include <bits/stdc++.h> using namespace std; int n, k, ans; int a[500101], b[500101], fl[500101]; int q[500101], qn; void solve() { scanf( %d%d , &n, &k); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); for (int i = 1; i <= k; i++) { scanf( %d , &b[i]); fl[b[i]] = 1; } int fl...
#include <bits/stdc++.h> using namespace std; template <typename T> inline T abs(T t) { return t < 0 ? -t : t; } const long long modn = 1000000007; inline long long mod(long long x) { return x % modn; } const int MAXN = 100010, INF = 0x3f3f3f3f; int n, m, deg, s[MAXN], p[MAXN]; int main() { sc...
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ps/1ps `default_nettype none module m26_rx_core #( parameter ABUSWIDTH = 16, ...
/* * 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...
/* ------------------------------------------------------------------------------- * (C)2012 Korotkyi Ievgen * National Technical University of Ukraine "Kiev Polytechnic Institute" *-------------------------------------------------------------------------------- */ //`timescale 1ps/1ps module LAG_test_random (); ...
// (C) 2001-2011 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...
//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...
/** * 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 computeXOR(long long int n) { if (n % 4 == 0) return n; if (n % 4 == 1) return 1; if (n % 4 == 2) return n + 1; return 0; } void solve() { vector<long long int> v; map<long long int, long long int> mp; long long int e, i, j,...
////////////////////////////////////////////////////////////////////// //// //// //// spi_top.v //// //// //// //// This file is part of the SPI I...
`timescale 1ns/10ps /* 功能:逻辑分析仪触发器 输入:nrst-0复位 clk-时钟 din-数据输入 level_sel-触发电平选择,0低电平,1高电平 level_mask-电平触发掩码,1为不关心 edge_sel-边沿触发通道选择,0~7 edge_mask-边沿触发掩码,1为不关心 输出:trig_out-1成功触发 修改:eleqian 2016-01-22 */ module la_trig(nrst, clk, din, level_sel, level_mask, edge_sel, edge_mask, trig_out); ...
#include <bits/stdc++.h> using namespace std; int a, b, x, y; int main() { cin >> a >> b; if (a > b) { x = b; y = (a - b) / 2; } else { x = a; y = (b - a) / 2; } cout << x << << y; }
//----------------------------------------------------------------- // AltOR32 // Alternative Lightweight OpenRisc // V2.0 // Ultra-Embedded.com // Copyright 2011 - 2013 // // Email: // // ...
#include <bits/stdc++.h> inline int read() { int f = 1, x = 0; char ch = getchar(); while (!(ch >= 0 && ch <= 9 )) { if (ch == - ) f *= -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = x * 10 + ch - 0 ; ch = getchar(); } return f * x; } int dx[8] ...
// Verilog netlist generated by Workcraft 3 module VME (d, lds, dtack, dsr, dsw, ldtack); input dsr, dsw, ldtack; output d, lds, dtack; wire U1_ON, IN_BUBBLE3_ON, IN_BUBBLE5_ON, U7_ON, IN_BUBBLE10_ON, OUT_BUBBLE1_ON, U14_ON, IN_BUBBLE16_ON, IN_BUBBLE18_ON, U20_ON, IN_BUBBLE23_ON, IN_BUBBLE25_ON, IN_BUBBLE28...
/** * 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...
/////////////////////////////////////////////////////////////////////////////// // vim:set shiftwidth=3 softtabstop=3 expandtab: // $Id: input_arbiter.v 5240 2009-03-14 01:50:42Z grg $ // // Module: input_arbiter.v // Project: NF2.1 // Description: Goes round-robin around the input queues and services one pkt // ...
#include <bits/stdc++.h> using namespace std; map<long, long> cmap; map<long, long>::iterator it; bool visit[200005]; long c[200005]; vector<long> graph[200005]; long res = 0, mac, counter; void DFS(long node); int main(void) { long long n, m, k, i, l, r, j; cin >> n >> m >> k; memset(visi...
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ps/1ps `default_nettype none module jtag_master #( parameter BASEADDR = 16'h000...
/** * 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, c; int ans; scanf( %d%d%d , &a, &b, &c); ans = (a - b) * c; if (!(ans % b)) ans /= b; else { ans /= b; ans += 1; } printf( %d n , ans); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; cout << n << ; for (int i = 1; i < n; i++) { cout << i << ; } }
#include <bits/stdc++.h> int main() { int n, m; scanf( %d %d , &n, &m); char a[1005][1005]; for (int k = 0; k < n; k++) { scanf( %s , a[k]); } char b[1005][1005] = {0}; for (int x = 1; x < n - 1; x++) { for (int y = 1; y < m - 1; y++) { if (a[x - 1][y] == # && a[x - 1...
module \$__COUNT_ (CE, CLK, OUT, POUT, RST, UP); input wire CE; input wire CLK; output wire OUT; (* force_downto *) output wire[WIDTH-1:0] POUT; input wire RST; input wire UP; parameter COUNT_TO = 1; parameter RESET_MODE = "RISING"; parameter RESET_TO_MAX = 0; parameter HAS...
#include <bits/stdc++.h> using namespace std; string s; long long ans[2200], MOD = 1000003; long long dp[2200][2200], inv[2200], fac[2200], ifac[2200]; void init_math(int N) { inv[1] = 1LL; for (int i = 2; i <= N; i++) inv[i] = (MOD - ((MOD / i) * inv[MOD % i]) % MOD); fac[0] = 1LL; ifac...
#include <bits/stdc++.h> using namespace std; int n, a, d, t, v; double tim[200000]; double jisuan(double a, double vmax, double s) { double t = (vmax) / a; if (0.5 * a * t * t > s) return sqrt(s * 2 / a); else return t + (s - 0.5 * a * t * t) / vmax; } int main() { scanf( %d%d%d...
// file: testclk_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 disclaimer is not a...
#include <bits/stdc++.h> using namespace std; int n; int v[1100]; int pd[1100][1 << 8]; int qtd1, qtd2; int vis[1100][1 << 8]; int inv[1100]; vector<int> pos[10]; bool check(int mask) { for (int i = 0; i < 8; ++i) { if (mask & (1 << i)) continue; if (qtd1) return false; } retur...
#include <bits/stdc++.h> using namespace std; int a[200010], b[200010]; int n, m; inline bool isprime(int x) { for (int i = 2; i * i <= x; i++) if (x % i == 0) return 0; return 1; } unsigned long long hashseed; unsigned long long h1[200010], h2[200010], t[200010]; inline void prehash() { ...
#include <bits/stdc++.h> using namespace std; const long long MOD = (long long)(1e9 + 7); const int inf = (int)INFINITY; const long long INF = (long long)INFINITY; const int MAX = (int)(2e5 + 5); const int maxn = 2e5 + 5; int n, m, k, p[maxn], path[maxn]; vector<int> in[maxn], out[maxn]; int maxa, min...
/* An 8 clock of latency shift-register FIFO. (8bit queue) * * This really is an 8 bit circular array with a write pointer that moves but * it will always read from position zero. Reading empty values will * return zero. * * Created by David Tran * Version 0.1.0.0 * Last Modified:04-24-2014 */ module shift_fi...
#include <bits/stdc++.h> int N; int T[20000 + 10]; int Cnt[20000 + 10]; int Ans; int main() { scanf( %d , &N); for (int i = 0; i < N; i++) scanf( %d , &T[i]); Ans = -1000000000; for (int i = 1; i <= N; i++) if (N % i == 0 && N / i >= 3) { for (int j = 0; j < i; j++) Cnt[j] = 0; ...
// file: clk_wiz_v3_6_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 disclaimer is ...
#include <bits/stdc++.h> const int N = 1000000; int n; char str[N + 10]; int cdog = 0, fdog = 0, ldog = 0, cbone = 0, fbone = 0, lbone = 0; int cntd[N + 10], cntb[N + 10]; int nxtd[N + 10], nxtb[N + 10]; int lstd[N + 10], lstb[N + 10]; int tp1[N + 10], tp2[N + 10][2]; bool dp[N + 10]; bool chk(int x...
#include <bits/stdc++.h> int inp() { char c = getchar(); while (c < 0 || c > 9 ) c = getchar(); int sum = 0; while (c >= 0 && c <= 9 ) { sum = sum * 10 + c - 0 ; c = getchar(); } return sum; } int n, x[200010]; long long ans[200010], sum[200010]; void solve(int a, in...
/** * 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 MAX_N = (int)2e5 + 100; const int mod = (int)1e9 + 7; int cnt[MAX_N]; inline int mul(int x, int y) { return (long long)x * y % mod; } inline int powMod(int x, int n) { int ret = 1; while (n > 0) { if (n & 1) ret = mul(ret, x); x = m...
// See bug75 module autoinst_interface (/*AUTOINOUTMODULE("autoinst_interface_sub")*/ // Beginning of automatic in/out/inouts (from specific module) output [7:0] count, input clk, input reset, input start, my_svi.master my_svi_port, my_svi my_svi_noport, my_svi my_svi_noport_upper_decl //...
// soc_design_mm_interconnect_0_avalon_st_adapter_008.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 16.0 211 `timescale 1 ps / 1 ps module soc_design_mm_interconnect_0_avalon_st_adapter_008 #( parame...
/*+-------------------------------------------------------------------------- Copyright (c) 2015, Microsoft Corporation All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code ...
#include <bits/stdc++.h> using namespace std; int mo[10]; int main() { int n; scanf( %d , &n); int a[n + 1]; for (int i = int(0); i <= int(n - 1); i++) { scanf( %d , a + i); } sort(a, a + n); a[0] = 1; for (int i = int(1); i <= int(n - 1); i++) { if (a[i] > a[i - 1]) ...
#include <bits/stdc++.h> using namespace std; int n, m, d[200], g[200][200], dp[200][200], ans[200]; int cnt, st[200], ed[200]; bool flag[200]; void dfs1(int u) { flag[u] = true; st[u] = ++cnt; for (int i = 1; i <= n; i++) if (g[u][i] == 1 && !flag[i]) dfs1(i); ed[u] = ++cnt; } void ...
#include <bits/stdc++.h> inline int getint() { register char ch; while (!isdigit(ch = getchar())) ; register int x = ch ^ 0 ; while (isdigit(ch = getchar())) x = (((x << 2) + x) << 1) + (ch ^ 0 ); return x; } const int N = 101, K = 41, mod = 1e9 + 7; int k, f[N][K], tmp[K]; std::fo...
#include <bits/stdc++.h> int main() { int tab[2000], i, max = 0, posmax = 0, index = -1, n; scanf( %d , &n); for (i = 0; i < n; i++) { scanf( %d , &tab[i]); if (tab[i] > max) { max = tab[i]; posmax = i + 1; } } while (max-- && index == -1) for (i = 0; i < n;...
#include <bits/stdc++.h> using namespace std; long long n, m, k; long long x[1000005], r, cur[1000005]; long long len; bool check(long long cnt) { long long res = 0, s = 0; for (int i = (1); i < (n + 1); i++) cur[i] = 0; for (int i = (1); i < (r + 1); i++) s += x[i]; for (int i = 1; i <= n; i+...
/* * 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 agr...
#include <bits/stdc++.h> using namespace std; const int maxn = 3e5 + 5; const long long inf = 1e18 + 9; int n, m, k, q; vector<pair<int, int> > g[maxn]; pair<long long, pair<int, int> > edges[maxn]; pair<int, int> query[maxn]; struct data { int id; long long val; bool operator<(const data& o...
// (C) 2001-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 doc...
/* * 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; template <typename T, typename U> std::istream& operator>>(std::istream& i, pair<T, U>& p) { i >> p.first >> p.second; return i; } template <typename T> std::istream& operator>>(std::istream& i, vector<T>& t) { for (auto& v : t) { i >> 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...
/* * 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-2008 Easics NV. // This source file may be used and distributed without restriction // provided that this copyright statement is not removed from the file // and that any derivative work contains the original copyrigh...
/* * MBus Copyright 2015 Regents of the University of Michigan * * 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 ...
#include <bits/stdc++.h> using namespace std; void Read(int &n) { int sign = 1; n = 0; char c; do { c = getchar(); } while (!isdigit(c) && c != - ); if (c == - ) { c = getchar(); sign = -1; } do { n = n * 10 + c - 48; c = getchar(); } while (isdigi...