text
stringlengths
59
71.4k
#include <bits/stdc++.h> int n, u[1001], v[1001], dem[1001], ans = 0; using namespace std; void input() { cin >> n; for (int i = 1; i < n; i++) { cin >> u[i] >> v[i]; } } void output() { cout << ans << endl; } void solve() { for (int i = 1; i <= n; i++) { for (int j = 1; j < n; j...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:64000000 ) using namespace std; int a[1100][1100], pt[1100], b[] = {25, 18, 15, 12, 10, 8, 6, 4, 2, 1}, ef, n; map<string, int> m; string st[1100]; int f(int aa, int bb) { if (pt[aa] != pt[bb]) return pt[aa] > pt[bb]; else { for (i...
/* Save Register Files Definition Slave: offset 0: Address: 32-bits start address offset 2: control: offset 1: status: */ module CAMERA_IF( // avalon MM slave port, ISP1362, host control // global //===== avalon MM s1 slave (read/write) // read/write avs_s1_clk, avs_s1_address, avs...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long int n, k; cin >> n >> k; long long int ans = 0; if (n < k) { cout << n << endl; continue; } while (n != 0) { if (n % k == 0) { n = n /...
#include <bits/stdc++.h> char c[99]; int i, x; int main() { for (;;) { scanf( %s , c); fflush(stdout); ; if (*c == e ) break; for (i = 2; i <= 1 << 30; i <<= 1) { printf( ? %d %d n , i, i >> 1); fflush(stdout); ; scanf( %s , c); fflush(std...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long a, b, c; scanf( %lld%lld%lld , &a, &b, &c); long long ans = 0x7f7f7f7f7f7f7f7f; long long ca, cb, cc; for (long long i = 1ll; i <= 15000ll; i++) { long long a1, c1; ...
`timescale 1ns / 1ps /* This file is part of JT51. JT51 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. JT51 program is di...
/* ########################################################################### # Function: A mailbox FIFO with a FIFO empty/full flags that can be used as # interrupts. # # E_MAILBOXLO = lower 32 bits of FIFO entry # E_MAILBOXHI = upper 32 bits of FIFO entry # # Notes: ...
#include <bits/stdc++.h> using namespace std; int main() { int vp, vd, t, f, c; cin >> vp >> vd >> t >> f >> c; int vs = vd - vp; if (vp > vd) { cout << 0; return 0; } if (vp == vd) { cout << 0; return 0; } double d = vp * t; d += d / (1.0 * vs) * vp; ...
#include <bits/stdc++.h> using namespace std; template <class C> void mini(C& a, C b) { a = min(a, b); } template <class C> void maxi(C& a, C b) { a = max(a, b); } void a() { int n; cin >> n; vector<int> a(n), b(n), c(n); for (int i = 0; i < n; i++) cin >> a[i]; for (int i = ...
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; const int INF = 1000000001; const long long LINF = 1000000000000000001LL; int len[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; string days[] = { monday , tuesday , wednesday , thursday , friday , satu...
#include <bits/stdc++.h> struct help { long int money; long int friends; }; void fusion_sort(struct help *p, long int n); void bablesort(struct help *p, long int n); int main() { long int n, m; scanf( %ld %ld , &n, &m); struct help *p = (struct help *)malloc(sizeof(struct help) * n); f...
#include <bits/stdc++.h> using namespace std; const int M = 200002; int val[M]; vector<int> vec[33]; set<int> st; struct Nod { int v; int id; bool operator<(const Nod &cmp) const { if (v == cmp.v) return id < cmp.id; return v > cmp.v; } } p[M]; int n; void init() { for ...
/* 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 law...
#include <bits/stdc++.h> using namespace std; const int N = 5e4 + 10, max_node = N * 200; int n, m, q, C, c[N], a[N], size[N], heavy[N], dfn[N], dfn_t, top[N], father[N], tt, lo[max_node], ro[max_node], addv[max_node]; long long sum[max_node], sum2[max_node]; vector<int> graph[N], nodes[N]; void dfs1(...
#include <bits/stdc++.h> using namespace std; int n, k, a, b, c, d, now, f[1001]; bool jud[1001]; int main() { cin.sync_with_stdio(false); cin >> n >> k; cin >> a >> b >> c >> d; if (k < n + 1 || n == 4) { cout << -1 << endl; return 0; } f[1] = a; f[2] = c; f[n - 1] =...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-9; const int inf = 2000000000; const long long infLL = 9000000000000000000; template <typename first, typename second> ostream &operator<<(ostream &os, const pair<first, second> &p) { return os << ( << p.first << , << p.second << ...
#include <bits/stdc++.h> using namespace std; int min(int a, int b) { return a > b ? b : a; } int main() { int n, m; cin >> n >> m; cout << min(n, m) + 1 << endl; for (int i = 0; i <= min(n, m); i++) cout << i << << min(n, m) - i << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int N, tmp; bool flag = false; int main() { scanf( %d , &N); for (int i = 0; i < N; i++) { scanf( %d , &tmp); if (tmp == 1) flag = true; } if (flag) printf( %d , -1); else printf( %d , 1); return 0; }
#include <bits/stdc++.h> using namespace std; struct node { node *next[26]; node() { for (int i = 0; i < 26; i++) next[i] = NULL; } }; void insert(node *root, string &str) { node *current = root; for (char ch : str) { if (current->next[ch - a ] == NULL) { current->next[c...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 03/18/2016 03:28:31 PM // Design Name: // Module Name: Round_Sgf_Dec // Project Name: // Target Devices: // Tool Versions: // Description: // // Dep encies: // /...
#include <bits/stdc++.h> using namespace std; long long int to_reach(long long int number, long long int moves, long long int target) { if (target == 0) { return (number / moves); } else { long long int res = (target - number) / moves; return res; } } int m...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; string str; cin >> n >> str; int a = 0; int d = 0; for (int i = 0; i < n; i++) { if (str[i] == A ) { a++; } else { d++; } } if (a > d) { ...
#include <bits/stdc++.h> using namespace std; const int Direction[4][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; const int Nmax = 200010; int n, k; long long a[20000], pref[20000]; long long f[60][500][500]; long long diff[500][2]; int main() { ios::sync_with_stdio(0); cin >> n >> k; for (int i...
#include <bits/stdc++.h> using namespace std; const int N = 1e3 + 5; struct edge { int u, v, id; edge(int a = 0, int b = 0, int c = 0) { u = a, v = b, id = c; } }; vector<edge> S, M, E; struct dsu { int par[N]; vector<edge> ed; dsu() { memset(par, -1, sizeof par); } int get_par(int u...
// *************************************************************************** // *************************************************************************** // Copyright 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
#include <bits/stdc++.h> using namespace std; int gcd(int x, int y) { if (x == 0) return y; return gcd(y % x, x); } int main() { int n, m, x, g; cin >> n >> m >> x; g = x - 1; for (int i = 1; i < n; ++i) { scanf( %d , &x); g = gcd(g, x - 1); } set<int> second; int...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e3 + 10; const int INF = 99999999; const double eps = 1e-4; int dp[MAXN]; int main() { int n, m, c0, d0; cin >> n >> m >> c0 >> d0; memset(dp, 0, sizeof(dp)); for (int i = c0; i <= n; i++) dp[i] = i / c0 * d0; for (int i = 1...
#include <bits/stdc++.h> using namespace std; template <class T> inline void chkmin(T &a, T b) { if (a > b) a = b; } template <class T> inline void chkmax(T &a, T b) { if (a < b) a = b; } inline int read() { int s = 0, f = 1; char ch = getchar(); while (!isdigit(ch) && ch != - ) ch ...
/** * 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 ini() { int x; scanf( %d , &x); return x; } long long inl() { long long x; scanf( %lld , &x); return x; } void file_mamager() {} int arr[105], mask[105], dp[105][1 << 17]; pair<int, int> path[105][1 << 17]; vector<int> primes; ...
/////////////////////////////////////////////////////// // Copyright (c) 2008 Xilinx Inc. // All Right Reserved. /////////////////////////////////////////////////////// // // ____ ___ // / /\/ / // /___/ \ / Vendor : Xilinx // \ \ \/ Version : 12.i (O.4) // \ \ Descripti...
// Name: WcaRssi.v // // Copyright(c) 2013 Loctronix Corporation // http://www.loctronix.com // // 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 2 // of the License, or...
#include <bits/stdc++.h> using namespace std; const long long MAX = 105; const long long MAXV = 2e5 + 1; const long long INF = 1e9; bool prime[MAXV]; void sieve() { memset(prime, true, sizeof(prime)); prime[0] = prime[1] = false; for (long long i = 2; i * i < MAXV; i++) { if (prime[i]) { ...
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /stack:200000000 ) #pragma GCC optimize( O3 ) #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) ifstream fin( input.txt ); ofstream fout( output.txt ); bool isPrime(int x) { if (x <= 4 || x % 2 == 0 || x % 3 == 0...
#include <bits/stdc++.h> using namespace std; struct Edge { int v; Edge *link; } edge[400010 * 2], *adj[200010], *tree[200010 * 2]; int totE, con, root, currT, top, top1; int totCut, totBi; int dep[200010], deps[200010], num[200010], dfn[200010], lowlink[200010], cut[200010], bi[200010], color...
/** * 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 dx[] = {1, -1, 0, 0}; int dy[] = {0, 0, -1, 1}; int tt[1016][1016]; int hh[1016][1016]; int n, m; int ex, ey; queue<int> q; queue<int> p; void bfs() { while (!p.empty()) { int x = p.front(); int y = q.front(); p.pop(); q.p...
#include <bits/stdc++.h> using namespace std; const int maxN = 1e3 + 9, lg = 19, MOD = 1e9 + 7, maxV = 1e6 + 9; pair<int, int> arr[3]; int dp[maxN][maxN]; pair<int, int> auxi[maxN][maxN]; bool vi[maxN][maxN]; int dst(pair<int, int> one, pair<int, int> two) { return abs(one.first - two.first) + abs(two...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, a, b, i, j, t, p = 0, q = 0; int x[200001]; cin >> n >> m; for (i = 1; i <= n; ++i) { cin >> t; if (t == -1) p++; else q++; } for (i = 0; i < m; ++i) { cin >> a >> b; if ((b - a...
#include <bits/stdc++.h> using namespace std; using LL = long long; constexpr int N = 1e5 + 5; string s; int n; int f(int x, int y) { int z = x; int res = 0; for (int i = 0; i < n; i++) { if (s[i] == z) { res++; z = x + y - z; } } if (res & 1) res -= (x != y);...
//Legal Notice: (C)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 do...
#include <bits/stdc++.h> using namespace std; const int N = 300000 + 15; int n; int a[N]; char c[N]; int flag, st, bb, rr, ll, cc, dd, ee, hh; int main() { scanf( %d , &n); for (int i(1); i <= (n); ++i) scanf( %d %c , a + i, c + i); long long ans = 0; for (int i(1); i <= (n); ++i) if...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: dcfifo // ============================================================ // File Name: fifo_69x256.v // Megafunction Name(s): // dcfifo // // Simulation Library Files(s): // altera_mf // ===============================...
#include <bits/stdc++.h> using namespace std; const int maxn = 5e5 + 7; const int INF = 1e9 + 7; const int MOD = 1e9 + 7; struct as { int id, x; } a[maxn]; int vis[maxn]; bool cmp(as a, as b) { return a.x < b.x; } vector<int> g[maxn]; vector<int> ans; set<int> tmp; bool check(as a) { int...
#include <bits/stdc++.h> using namespace std; int t[4000050], tag[4000050]; vector<int> v[1005000]; inline void refresh(int now) { t[now] = max(t[now << 1], t[now << 1 | 1]); } void pushdown(int l, int r, int now) { if (l == r) { tag[now] = 0; return; } tag[now << 1] += tag[now]; t...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017 // Date : Tue Apr 18 23:18:54 2017 // Host : DESKTOP-I9J3TQJ running 64-bit major re...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 10; const long long mod = 1e9 + 7; long long n, m; long long fac[maxn]; long long ksm(long long a, long long b) { long long ans = 1, base = a % mod; while (b) { if (b & 1) ans = ans * base % mod; base = base * base % mo...
//Legal Notice: (C)2018 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...
`timescale 1ns/1ns module test_mips (/*port details*/); reg clk,rst,clk_i; integer i; wire [31:2] PrAddr; wire [3:0] PrBe; wire [31:0] PrWD; wire [31:0] PrRD; wire [7:2] HWInt; wire [31:0] Dev1_RD; wire [31:0] Dev2_RD; wire Dev1_Irq,Dev2_Irq; wire [3:2] DevAddr;...
/** * 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() { long long int k, n; cin >> n >> k; long long int half, d, c; half = (n / 2); d = (half / (k + 1)); c = (k * d); cout << d << << c << << (n - c - d); 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 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 M = 1e9 + 7; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vector<long long> L(n), R(n), A(n); for (int i = 0; i < n; ++i) { cin >> L[i]; } for (int i = 0; i < n; ++i) { cin >> R[i]...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 04:05:15 08/14/2013 // Design Name: siete_segmentos_principal // Module Name: C:/Users/Fabian/Desktop/Laboratorio 1/sietesegmentos/pruebas.v // Project Name: sietese...
module mux_8to1_16bit(Q, S, i1, i2, i3, i4, i5, i6, i7, i8); input [0:15] i1, i2, i3, i4, i5, i6, i7, i8; input [0:2] S; output [0:15] Q; mux8to1 mux0(Q[0], S, i1[0], i2[0], i3[0], i4[0], i5[0], i6[0], i7[0], i8[0]); mux8to1 mux1(Q[1], S, i1[1], i2[1], i3[1], i4[1], i5[1], i6[1], i7[1], i8[1]); mux8to1 ...
/* 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...
/* This file is part of JT12. JT12 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. JT12 program is distributed...
module testbench; logic clk; bsg_nonsynth_clock_gen #( .cycle_time_p(1000) ) clock_gen ( .o(clk) ); logic reset; bsg_nonsynth_reset_gen #( .num_clocks_p(1) ,.reset_cycles_lo_p(4) ,.reset_cycles_hi_p(4) ) reset_gen ( .clk_i(clk) ,.async_reset_o(reset) ); localparam els_l...
// Copyright (c) 2015 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...
#include <bits/stdc++.h> using namespace std; const int MAX = 1e5 + 25; long long a[MAX]; int main() { ios_base::sync_with_stdio(false); long long n, k, h; cin >> n >> h >> k; for (int i = 0; i < n; i++) cin >> a[i]; long long ans = 0; long long in = a[0]; for (int i = 1; i < n; i++)...
#include <bits/stdc++.h> using namespace std; long long MOD = 1000000007; long long INF = 1LL << 60; int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); int n; cin >> n; vector<long long> l(n), r(n), m(n); for (long long i = (long long)(0); i < (n); i++) { cin >> m[i]; }...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); int n; cin >> n; vector<int> a(n + 1); for (int i = 1; i <= n; i++) cin >> a[i]; stack<int> lid, rid; vector<int> mxl(n + 1), mxr(n + 1); for (int i = 1; i <= n; i++) { while (!lid.empty() &...
#include <bits/stdc++.h> using namespace std; const int mxN = 1e6; int n, k, a[mxN], l[mxN]; struct dsu { int p[mxN], ld[mxN], lb[mxN]; void init() { iota(p, p + n, 0); iota(lb, lb + n, 0); } int find(int x) { return x == p[x] ? x : (p[x] = find(p[x])); } void join(int x, int y) ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 7; long long ans, dp[N]; int ed, n, m; struct node { int w, c; double val; node(int a = 0, int b = 0) : w(a), c(b) {} bool operator<(const node &b) const { return val > b.val; } } a[N], tmp[N]; long long DP() { for (int ...
#include <bits/stdc++.h> using namespace std; void print(vector<int> v) { for (int i = 0; i < v.size(); i++) { if (v[i] != 0) { cout << v[i]; } } cout << endl; } void solve(vector<int>& v, int even, int odd) { if (v.size() == 1) { cout << -1 << endl; return; }...
/** * This is written by Zhiyang Ong * and Andrew Mattheisen */ `timescale 1ns/100ps /** * `timescale time_unit base / precision base * * -Specifies the time units and precision for delays: * -time_unit is the amount of time a delay of 1 represents. * The time unit must be 1 10 or 100 * -base is the time base...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 23:45:49 08/25/2014 // Design Name: Counter_x // Module Name: E:/Summer Course/Top_Computer_IOBUS_VGA_PS2_N3/test_counter.v // Project Name: Top_Computer_IOBUS_VGA_P...
#include <bits/stdc++.h> using namespace std; const int MAXN = 100 * 1000 + 17; long long n, a[MAXN], ans; int main() { ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i < n; i++) { int t = log2(n - i); a[...
module s27_path ( G1, G2, clk_net, reset_net, G3, G0, G17); // Start PIs input G1; input G2; input clk_net; input reset_net; input G3; input G0; // Start POs output G17; // Start wires wire G1; wire net_5; wire net_15; wire net_27; wire G17; wire reset_net; wire net_14; wire G3; wire net_26; wire clk_net; wire net_1...
#include <bits/stdc++.h> using namespace std; const int prime = 999983; const int INF = 0x7FFFFFFF; const long long INFF = 0x7FFFFFFFFFFFFFFF; const double pi = acos(-1.0); const double inf = 1e18; const double eps = 1e-6; const long long mod = 1e9 + 7; long long qpow(long long a, long long b) { l...
#include <bits/stdc++.h> const double eps = 1e-10; const float epsf = 1e-6; using namespace std; inline long long int __gcd(long long int a, long long int b) { if (a == 0 || b == 0) { return max(a, b); } long long int tempa, tempb; while (1) { if (a % b == 0) return b; ...
// nios_tester_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 18.1 625 `timescale 1 ps / 1 ps module nios_tester_mm_interconnect_0_avalon_st_adapter #( parameter in...
#include <bits/stdc++.h> using namespace std; int main() { ofstream out( output.txt ); auto start = chrono::high_resolution_clock::now(); long long t = 1; for (long long test = 1; test <= t; test++) { long long n; cin >> n; vector<long long> a(n); pair<long long, long long> b...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 10; int n, a, b; int main() { cin >> n >> a >> b; int table1_count = 0; int table2_count = 0; int one_two_count = 0; int ans = 0; for (int i = 0; i < n; i++) { int t; cin >> t; if (t == 1) { boo...
#include <bits/stdc++.h> using namespace std; int F(int d); int G(int d); int n, ara[2 * 100010], dpf[2 * 100010], dpg[2 * 100010], k; bool visf[2 * 100010], visg[2 * 100010]; vector<int> vec; int add(int _a, int _b) { _a = (_a + 998244353) % 998244353; _b = (_b + 998244353) % 998244353; retur...
`include "bch_defs.vh" module xilinx_parallel #( parameter T = 3, parameter DATA_BITS = 5 ) ( input clk_in, input start, input [`BCH_SYNDROMES_SZ(P)-1:0] syndromes, input ack_done, output done, output ready, output [`BCH_SIGMA_SZ(P)-1:0] sigma, output [`BCH_ERR_SZ(P)-1:0] err_count ); `include "bch_params...
/* :Project FPGA-Imaging-Library :Design ColorGray2Channels :Function Covert Gray-scale to Channels. :Module Main module :Version 1.0 :Modified 2015-05-12 Copyright (C) 2015 Tianyu Dai (dtysky) <> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General P...
/** * 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, m; int U[5005], V[5005]; struct emm { int a, b, x; } a[5005]; bool cmp(emm x, emm y) { return x.x < y.x; } struct Edge { int v; Edge *next; } pool[5005 << 1], *h[5005]; int fa[5005], dep[5005], ans[5005]; int tot; void addEdge(int u,...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:102400000,102400000 ) using namespace std; int a[1005][1005]; int main() { int N, K, D, i, j; loop: while (~scanf( %d%d%d , &N, &K, &D)) { memset(a, 0, sizeof(a)); for (j = 0; j < N; ++j) { a[D - 1][j] = j; } for ...
#include <bits/stdc++.h> using namespace std; int n; vector<int> re; int main() { cin >> n; int least[n]; for (int i = 0; i < n; i++) cin >> least[i]; sort(least, least + n); int cont = 0; for (int i = 1; i < n; i++) { if (least[i] == least[i - 1]) { re.push_back(least[i]);...
#include <bits/stdc++.h> using namespace std; const int maxn = 1610; typedef int MAP[maxn][maxn]; int n, m; MAP A, B, flag, used; int total; int num[maxn * maxn], que[maxn * maxn * 2]; MAP temp; int px[] = {0, 0, 1, -1, 0}, py[] = {1, -1, 0, 0, 0}; bool isok(int x, int y) { return x >= 1 && x <= n &...
/** * 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; void getint(int &v) { char ch, fu = 0; for (ch = * ; (ch < 0 || ch > 9 ) && ch != - ; ch = getchar()) ; if (ch == - ) fu = 1, ch = getchar(); for (v = 0; ch >= 0 && ch <= 9 ; ch = getchar()) v = v * 10 + ch - 0 ; if (fu) v = -v; } ...
#include <bits/stdc++.h> using namespace std; const int MAX = 1e5; const int mod = 1e9 + 7; int cnt; int head[MAX + 5], to[4 * MAX + 5], nex[4 * MAX + 5]; void add(int u, int v) { to[++cnt] = v; nex[cnt] = head[u]; head[u] = cnt; } int n, m; int _cnt; long long prime[MAX + 5], es[MAX + 5...
/** * 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() { int n; cin >> n; int arr[n]; for (int i = 0; i <= n - 1; i++) cin >> arr[i]; vector<pair<int, int> > G[n]; int cnt = 0; for (int i = 0; i <= n - 1; i++) { for (int j = i + 1; j <= n - 1; j++) { if (arr[i] > arr[j]) ...
// (C) 2001-2013 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...
// Accellera Standard V2.5 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2010. All rights reserved. `include "std_ovl_defines.h" `module ovl_win_change (clock, reset, enable, start_event, test_expr, end_event, fire); parameter severity_level = `OVL_SEVERITY_DEFAULT; parameter width = ...
/* ######################################################################## ELINK CONFIGURATION REGISTER FILE ######################################################################## */ `include "elink_regmap.v" module erx_cfg (/*AUTOARG*/ // Outputs mi_dout, rx_enable, mmu_enable, remap_mode, remap_base, ...
#include <bits/stdc++.h> using namespace std; void prt(long x) { cerr << x; } void prt(long long x) { cerr << x; } void prt(unsigned x) { cerr << x; } void prt(unsigned long x) { cerr << x; } void prt(unsigned long long x) { cerr << x; } void prt(float x) { cerr << x; } void prt(double x) { cerr << x; }...
// DESCRIPTION: Example top verilog file for vpassert program // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2000-2012 by Wilson Snyder. `timescale 1ns/1ns module example; pli pli (); // Put on highest level of your design integer i; `define ten 10 reg \escaped[10] ...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of inst_edb_e // // Generated // by: wig // on: Mon Mar 22 13:27:59 2004 // cmd: H:\work\mix_new\mix\mix_0.pl -strip -nodelta ../../mde_tests.xls // // !!! Do not edit this file! Autogenerated by MIX !...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int vis[N], parent[N]; vector<int> v[N]; void dfs(int node) { vis[node] = 1; for (auto i : v[node]) { if (!vis[i]) { parent[i] = node; dfs(i); } } } int res[N]; int main() { int n, l, r, k = ...