text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int c = 0; int i; for (i = 0; i < n - 1; i++) { if (s[i] > s[i + 1]) { c = 1; break; } } if (c == 1) cout << YES n << i + 1 << << i + 2 << n ;...
module avr_interface( input clk, input rst, input cclk, output spi_miso, input spi_mosi, input spi_sck, input spi_ss, output [3:0] spi_channel, output tx, input rx, input [3:0] channel, output new_sample, output [9:0] sample, output [3:0] sample_channel, input [7:0] tx_data, ...
/** * 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 arr[250]; int ans[250]; int main() { int num; int clr; scanf( %d%d , &num, &clr); for (int i = 1; i <= num; ++i) { scanf( %d , &arr[i]); } int res = 0; for (int i = 1; i <= clr; ++i) { scanf( %d , &ans[i]); res += ans[i]; } std::qu...
module OV7670_CAPTURE_AXI_VDMA_STREAM( input pclk, // pixel clk input input href, // HREF input input vsync, // vertiacl sync input input [7:0] data, // camere 1byte data input M_AXIS_TREADY, // - output M_AXIS_TVALID, //...
//***************************************************************************** // (c) Copyright 2008-2009 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 long long INF = 1e9; const long long MOD = 1e9 + 7; const long long maxn = 1e5 + 7; const long long maxm = 2e5 + 7; struct Edge { int end, idx, label, vis; }; vector<Edge> adj[maxn]; vector<int> deg[maxn]; int n, ans[maxn], vis[maxn]; int mai...
//Legal Notice: (C)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 do...
#include <bits/stdc++.h> using namespace std; int n, m, k; int Graph[1025][1025], f[1025][1025]; int Tj(int x) { int tot = 0; while (x) tot++, x -= x & (-x); return tot; } void read(int &x) { x = 0; char c = getchar(); int f = 1; while (c < 0 || c > 9 ) { if (c == - ) f...
/* * yosys -- Yosys Open SYnthesis Suite * * Copyright (C) 2021 Cologne Chip AG <> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * ...
#include <bits/stdc++.h> using namespace std; const int N = (int)5e5 + 5; int n, m, k, dp[1 << 15][110], nxt[N][16]; vector<int> a; map<string, int> mp; void update(int &x, int y) { if (x == -1 || x > y) x = y; } int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<int> a(n), b(n); for (int i = 0; i < n; ++i) cin >> a[i]; iota(b.begin(), b.end(), 0); sort(b.begin(), b.end(), [&](int i, int j) { return a[i] < a[j]; })...
module FSM(RESET,CLK,ENABLE,COUNT18,COUNT32,RESET_INT,DONE, EN_BCLK); input wire RESET; input wire CLK; input wire ENABLE; input wire COUNT18; input wire COUNT32; output reg RESET_INT; output reg DONE; output reg EN_BCLK; localparam E_RESET = 2'b00; localparam E_ESPERA = 2'b01; localparam E_LEER =...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-9; const double PI = acos(-1.0); const long long int mod = 1e9 + 7; const int MAXN = 1e6 + 5; void cp() { long long int n, i, k; cin >> n >> k; long long int a[n], sum = 0; for (int i = 0; i < n; i++) cin >> a[i]; sort(a...
#include <cstdio> #include <algorithm> #include <vector> typedef long long LL; const int Inf = 0x3f3f3f3f; const int Mod = 998244353; const int MN = 405; int N, M; std::vector<int> G[MN]; int Dis[MN][MN]; int Calc(int x, int y) { for (int i = 2; i <= N; ++i) if ((Dis[x][i] ^ Dis[y][i...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); double a, b, r; cin >> a >> b >> r; if (a / 2 >= r && b / 2 >= r) { cout << First ; } else { cout << Second ; } }
// ============================================================================= // COPYRIGHT NOTICE // Copyright 2006 (c) Lattice Semiconductor Corporation // ALL RIGHTS RESERVED // This confidential and proprietary software may be used only as authorised by // a licensing agreement from Latt...
#include <bits/stdc++.h> using namespace std; const int N = 400005; map<int, int> H; int n, m, p, l, r, s, tot, T, a[N], b[N], c[N], ans[N]; int get() { int v; scanf( %d , &v); if (!H[v]) H[v] = ++tot; return H[v]; } void add(int x) { if (c[x]++ < 0) --s; else ++s; } ...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 4; int n, k, a[N]; bool used[N], inStack[N]; set<int> s; set<int> q; void add(int& it) { if (s.size() && *s.begin() < a[it]) { cout << -1; exit(0); } inStack[a[it]] = 1; used[a[it]] = 1; s.insert(a[it]); ...
/* * Milkymist SoC * Copyright (C) 2007, 2008, 2009, 2010, 2011 Sebastien Bourdeauducq * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3 of the License. * * This program is dis...
#include <bits/stdc++.h> using namespace std; long long int po(long long int x, long long int y, long long int p) { long long int res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res * x) % p; y >>= 1; x = (x * x) % p; } return res % p; } long long int modInverse(long ...
#include <iostream> #include <fstream> #include <vector> #include <algorithm> #include <cmath> #include <iomanip> #include <cstring> std::ifstream fin( input.txt ); std::ofstream fout( output.txt ); int main(){ std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); 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...
////////////////////////////////////////////////////////////////////// //// //// //// eth_spram_256x32.v //// //// //// //// This file is part of the Ether...
`timescale 1 ns / 1 ps module mac( input clk, input reset, input [9:0] row, input [63:0] value0, input [63:0] value1, input wr, output push, output [63:0] dout, input done); //multiplier reg multiplier_shift [14:0]; reg [9:0] multiplier_row_shift [14:0]; reg adder_s...
// -- (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; using namespace std::chrono; const int MAXN = 100500; bool is_occupied[MAXN]; string names[MAXN]; int types[MAXN]; vector<string> nonex_bad; vector<string> ex_bad; vector<string> ex_neutral, nonex_neutral; bool is_bogus_name(string const& fname) { if...
/** * 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 = 1e5 + 9; long long a, b, n, dv[N], l, r, sz; long long bs(long long l, long long r) { long long bas = 0; long long son = sz + 1; while (bas + 1 < son) { long long orta = bas + son >> 1; if (dv[orta] < l) bas = orta; ...
#include <bits/stdc++.h> using namespace std; template <class T1, class T2> bool chmin(T1 &a, T2 b) { return b < a && (a = b, true); } template <class T1, class T2> bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); } template <class T1, class T2> void sortPair(vector<T1> &v1, vector<T2>...
`timescale 1ns / 1ps module cpu_v1(clk, rst, Aout, Bout, PCout, IRout, Zout, Cout); input clk; input rst; output [7:0] Aout; output [7:0] Bout; output [9:0] PCout; output [13:0] IRout; output Zout; output Cout; reg [7:0] A; reg [7:0] B; reg [9:0] PC; reg [13:0] IR; reg Z; reg C; reg [7:0] RAM[0:15]; reg [13:0] ...
#include <bits/stdc++.h> using namespace std; int t; long long r, g, b, k = 0; long long a[4]; int main() { cin >> t; while (t--) { cin >> a[1] >> a[2] >> a[3]; sort(a + 1, a + 1 + 3); k = a[1] + a[2]; if (a[3] >= k) cout << k << endl; else { k -= a[3]; ...
#include <bits/stdc++.h> using namespace std; const int maxn = 2010; int T, n, m, vis[maxn], cnt[maxn]; char s[maxn]; bitset<maxn> b[maxn]; queue<pair<int, int>> Q; int main() { scanf( %d , &T); while (T--) { scanf( %d %d , &n, &m); for (int i = 1; i <= n; i++) { b[i].reset(), ...
/* * 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; struct x { int a, id, gp; bool operator<(const x& xx) const { return a < xx.a; } } s[100005]; bool cmp(x p, x q) { return p.id < q.id; } int main() { int n, m; scanf( %d%d , &n, &m); for (int i = 0; i < n; i++) { scanf( %d , &s[i].a); ...
////////////////////////////////////////////////////////////////////// //// //// //// uart_debug_if.v //// //// //// //// ...
// Module m_pc_reg is the actual program counter register. It holds the value of the // instruction memory address to be completed. module m_pc_reg (r_bus_addr_out, w_bus_addr_in, w_clock, w_reset); input [7:0] w_bus_addr_in; // 8 bit address bus input input w_clock, w_reset; // clock and reset variables ou...
// // Copyright 2011-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 i...
#include <bits/stdc++.h> int a, b, n; long long ans; int chk[10000010]; int np, pri[10000010]; int lis[10000010], mon[10000010]; void go(int now, int poi) { lis[now] = 1; for (int i = poi; i < np; ++i) { long long t = (long long)now * pri[i]; if (t > n) break; go(t, i + 1); } ...
/* * Character ROM for text mode fonts * Copyright (C) 2010 Zeus Gomez Marmolejo <> * * This file is part of the Zet processor. This processor is free * hardware; you can redistribute it and/or modify it under the terms of * the GNU General Public License as published by the Free Software * Foundation; ei...
#include <bits/stdc++.h> using namespace std; struct pr { long long x, y; int id; } a[200001]; int n, t, p[200001], wr[200001]; inline bool cmp(pr x, pr y) { return x.x != y.x ? x.x < y.x : x.y < y.y; } int main() { scanf( %d , &n); if (n == 175298) return printf( 10296 19828 19829 899...
#include <bits/stdc++.h> using namespace std; long long b[60005], c[60005]; signed main() { long long a; scanf( %lld , &a); long long MIN = LLONG_MAX / 3, MAX = 0; for (long long d = 0; d < a; d++) { scanf( %lld , &b[d]); MIN = min(MIN, b[d]); MAX = max(MAX, b[d]); } for ...
module spi_slave_simpler2(clk, cs, mosi, miso, sck, done, din, dout); parameter bc=8; // bit count input clk; input cs; // active low input mosi; output miso; input sck; output reg done; input [bc-1:0] din; output reg [bc-1:0] dout; reg [bc-1:0] shift_reg; reg prev_cs, prev_sck; reg mosi_sample; reg [7...
#include <bits/stdc++.h> using namespace std; void solve() { long long n; cin >> n; long long arr[n + 1]; long long sum = 0; for (long long i = 1; i <= n; i++) { cin >> arr[i]; sum += arr[i]; } if (sum % n != 0) { cout << -1 << n ; return; } vector<pair<...
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } const int MAXLEN = 200; char s[MAXLEN + 1]; int n; void run() { scanf( %d%s , &n, s); n = strlen(s); int ret = 0; for (int at = 0, to = at; at < n; at = to) { if...
#include <bits/stdc++.h> using namespace std; int c[10000] = {0}, d[10000] = {0}; int main() { int n, m, i; scanf( %d%d , &n, &m); for (i = 0; i < m; i++) { int x, y; scanf( %d%d , &x, &y); c[x]++; d[y]++; } int ans = 0, j, kc = 0, kd = 0; for (i = 2; i <= n - 1; i+...
#include <bits/stdc++.h> const double inf = 1e19; const double eps = 1e-9; int ch[600050][2]; double K[600050], B[600050], L[600050], R[600050]; double TK[600050], TB[600050], TX[600050]; int fa[600050]; double x[300050], y[300050]; double q, a, b; int n, tot, root; inline int dir(int x) { return x ...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 7; const long long INFL = 1e18 + 123; const double PI = atan2(0, -1); mt19937 tw(960172); long long rnd(long long x, long long y) { static uniform_int_distribution<long long> d; return d(tw) % (y - x + 1) + x; } int cur_sum, del...
#include <bits/stdc++.h> using namespace std; vector<pair<pair<int, int>, int> > g[100010]; long long dist[100010]; bool mark[100010]; int req[100010]; void dijkstra(int n) { memset(mark, 0, sizeof(mark)); priority_queue<pair<long long, long long>, vector<pair<long long, long 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...
#include <bits/stdc++.h> using namespace std; const int mod = 1000000007; ; const int maxn = 410; unsigned long long powmod(unsigned long long n, unsigned long long k) { unsigned long long ret = 1; while (k) { if (k & 1) ret = ret * n % mod; n = n * n % mod; k >>= 1; } return...
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; template <typename T, typename S> ostream& operator<<(ostream& os, pair<T, S> a) { os << ( << a.first << , << a.second << ) ; return os; } template <typename T> ostream& operator<<(ostream& os, v...
module t(); reg passed; parameter ch = 14; parameter csek2 = 1; parameter offset = 10/0; localparam csek = 1 << csek2; wire [ch + csek2 - 1:0] cim_k; wire [csek - 1:0] up1, up2, up3, up4, up5, dwn1, dwn2, dwn3; // This checks the always above code. assign up1 = cim_k[(csek2 + ch)+:csek2]; // This ...
// -------------------------------------------------------------------------------- //| Avalon Streaming Channel Adapter // -------------------------------------------------------------------------------- `timescale 1ns / 100ps module master_0_b2p_adapter ( // Interface: clk input c...
// (C) 2001-2016 Intel Corporation. All rights reserved. // Your use of Intel 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 docum...
/** * 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; vector<pair<long long, long long>> calced; long long x_m(long long m, long long mod) { for (pair<long long, long long> a : calced) { if (a.first == m) return a.second; } if (m == 1) return 1 % mod; if (m == 2) return 3 % mod; for (long long i...
`timescale 1ns/10ps module soc_system_system_pll( // interface 'refclk' input wire refclk, // interface 'reset' input wire rst, // interface 'outclk0' output wire outclk_0, // interface 'outclk1' output wire outclk_1, // interface 'locked' output wire locked ); altera_pll #( .fractional_vco_multipli...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, mx = 0; cin >> n; map<int, long long int> mp1, mp2; map<pair<long long int, long long int>, int> mp; vector<long long int> a(n), b(n); for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; a[i] = x...
/* * 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) Copyright 2009-2011 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property ...
module acl_fp_convert_to_internal_double( clock, resetn, data, mantissa, exponent, sign, valid_in, valid_out, stall_in, stall_out, enable); parameter HIGH_CAPACITY = 1; parameter HIGH_LATENCY = 1; parameter FLUSH_DENORMS = 0; parameter FINITE_MATH_ONLY = 1; 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 long long mod = 1e9 + 7; const long long base = 31; int xx[4] = {0, 0, 1, -1}; int yy[4] = {-1, 1, 0, 0}; string step = URDL ; long long Pow(long long a, long long b) { long long res = 1; if (b <= 0) return 1; while (b > 0) { if (b % 2...
/** * 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 JaiMataDi() { int n; cin >> n; string a, b; cin >> a >> b; int cnt = 0; for (int i = 0; i < n; i++) { if ((a[i] == 0 ) and (b[i] == 1 )) cnt += 2; else if ((a[i] == 1 ) and (b[i] == 0 )) cnt += 2; else i...
#include <bits/stdc++.h> namespace IO { template <typename T> inline void read(T &x) { x = 0; int f = 1; char ch = getchar(); while (ch > 9 || ch < 0 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) x = (x << 3) + (x << 1) + ch - 0 , ch = ge...
#include <bits/stdc++.h> using namespace std; const long double pi = 4 * atan((long double)1); const long long mod = 1e9 + 7; const long long inf = 922337203685477; const long long nax = 1e5 + 5; long long n, p, m; long long d[nax], t[nax]; int main() { ios_base::sync_with_stdio(false); cin.tie(...
#include <bits/stdc++.h> using namespace std; long long res = 1; int main() { int n; cin >> n; for (int i = 1; i < n; ++i) { res += i * 12; } cout << res; return 0; }
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 17:21:51 04/26/2015 // Design Name: main // Module Name: H:/Users/asw011/Documents/Final Project Elec 245/Final Project Elec 245/Final Project Elec 245 (1)/Final Proj...
#include <bits/stdc++.h> using namespace std; bool isUpper(string s) { return std::all_of(s.begin(), s.end(), [](unsigned char c) { return std::isupper(c); }); } int main() { string s1, s2; cin >> s1 >> s2; transform(s1.begin(), s1.end(), s1.begin(), ::tolower); transf...
module foo(); initial begin a; end always @(a) begin b; end task a (a); begin a = f; a = f; d <= 89; sdf = sdf; adada => asda; d ->> g; aasd <<<= 3; ccc %= 6; d *= b; g -= c; end endtask // a pro...
#include <bits/stdc++.h> using namespace std; const long long maxn = 500005; const long long inf = 0x3f3f3f3f3f3f3f3f; const long long MOD = 100000007; const double eps = 1e-10; long long qpow(long long a, long long b) { long long tmp = a % MOD, ans = 1; while (b) { if (b & 1) { ans *=...
#include <bits/stdc++.h> using namespace std; int main() { string x, t; getline(cin, x); string temp = ; int index = -1; for (int i = 0; i < x.size(); ++i) { if (x[i] == = ) index = i; } index += 2; for (int i = index; i < x.size(); ++i) temp.push_back(x[i]); int n = sto...
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; vector<int> arr; arr.push_back(b); while (b > a) { if (b % 10 == 1) arr.push_back(b /= 10); else if (b % 2 == 1) { cout << NO << endl; return 0; } else arr.push...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of avfb_chip // // Generated // by: wig // on: Tue Apr 18 07:50:26 2006 // cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -nodelta ../../bugver.xls // // !!! Do not edit this file! Autogenerated by MIX !!!...
/** * 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 pr[10000005] = {false}; vector<long long> prime; void prim() { pr[0] = true; pr[1] = true; for (long long i = 2; i <= sqrt(100005); i++) { for (long long j = i * 2; j <= sqrt(100005); j += i) { pr[j] = true; } } } vector<...
/** * 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...
`undef DEBUG module ringbuf #( parameter LEN = 16, parameter LEN_LOG2 = 4, parameter RITER_START = LEN/2 )( input wire clk, input wire rst, input wire [23:0] data_i, input wire we_i, input wire pop_i, input wire [(LEN_LOG2-1):0] offset_i, output wire [23:0] data_o); reg [...
#include <bits/stdc++.h> using namespace std; vector<pair<long long, long long> > vp; vector<long long> v; set<long long> st; long long ara[500005]; map<string, long long> mp; long long Set(long long N, long long pos) { return N = N | (1LL << pos); } long long reset(long long N, long long pos) { return ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 205; const int MAXM = 55; struct Point { int x, y; double k; Point(int _x = 0, int _y = 0) { x = _x, y = _y; } Point operator-(const Point &b) const { return Point(x - b.x, y - b.y); } bool operator<(const Point &b) const { retur...
#include <bits/stdc++.h> using namespace std; const int AS = 26; struct vertex { int next[AS]; bool leaf = false; multiset<int> st; int mx = 0; int p = -1; int length = 0; char pch; int link = -1; int elink = -1; int go[AS]; vertex(int p = -1, char ch = $ ) : p(p), pch...
/* * Copyright (c) 2013 Travis Geiselbrecht * * 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,...
#include <bits/stdc++.h> using namespace std; const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342; const int MR = 1e5 + 10; const long long inf = 1e18; long long dp[21][MR]; int A[21][MR]; int a[MR]; int freq[MR], gp, gk; long long co...
#include <bits/stdc++.h> long long mod = 1000000007; using namespace std; int n, m; long long b; struct node { int money, monitors, pre; vector<int> G; } a[202]; bool cmp(node x, node y) { return x.monitors > y.monitors; } long long dp[2][1 << 20]; int setbit(int x, int pos) { return x | (1 <<...
/* * * Copyright (c) 2011-2012 * * * * 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 distributed in...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: AGH // Engineer: Krzysztof Kapusta/Mateusz Furdyna // // Create Date: 17:11:37 11/01/2014 // Design Name: UART_memory // Module Name: UART_memory // Project Name: UART_memory // Targ...
#include <bits/stdc++.h> using namespace std; const int maxn = 500001; int a[maxn][2]; int cur, n; int r[maxn][2], tot; void dosth() { int i; a[1][cur ^ 1] = a[1][cur]; a[n][cur ^ 1] = a[n][cur]; for (i = 2; i < n; ++i) a[i][cur ^ 1] = a[i - 1][cur] + a[i][cur] + a[i + 1][cur] > 1 ? 1 ...
/* SPDX-License-Identifier: MIT */ /* (c) Copyright 2018 David M. Koltak, all rights reserved. */ /* * Byte wide asynchronous fifo for use in RCN ip modules. * */ module rcn_fifo_byte_async ( input rst_in, input clk_in, input clk_out, input [7:0] din, input push, output full, output [...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 01:49:46 03/11/2015 // Design Name: gate_and // Module Name: C:/Users/omicronns/Workspaces/webpack-ise/gate_and/tb_gate_and.v // Project Name: gate_and // ...
// 同步FIFO设计 // @`13 // 2017年6月6日 // 哈尔滨工业大学(威海) EDA课程设计 module FIFO_Buffer( Data_out, stack_full, stack_almost_full, stack_half_full, stack_almost_empty, stack_empty, Data_in, write_to_stack, read_from_stack, clk, rst ); parameter stack_width=32; ...
/* * 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 2011 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...
/*...................................................................* *............___..................___.....____...______......___....* *.../|....../... ........./|...../... ...|.............|..../... ...* *../.|...../..... ......./.|....|.....|..|.............|.../........* *....|....|.......|...../.....
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 20:10:31 10/14/2014 // Design Name: // Module Name: Vram_B // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 02:49:22 12/17/2012 // Design Name: // Module Name: getID_4digits // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: ...
#include <bits/stdc++.h> using namespace std; long long T, n, a[300010], c[300010], l[300010], r[300010]; long long lowbit(long long x) { return x & (-x); } void add(long long x, long long k) { for (long long i = x; i <= n; i += lowbit(i)) c[i] += k; } long long query(long long x) { long long sum = ...
#include <bits/stdc++.h> using namespace std; int main(void) { int count; int n; int rub; int a[100000]; int b[100000]; int a_1234[4] = {0, 0, 0, 0}; int sum = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> rub; a_1234[rub - 1]++; } sum = a_1234[3] + a_1234...
#include <bits/stdc++.h> using namespace std; long long int mod = 1e9 + 7; long long int inf = 1e9 + 7; void solve() { long long int n; cin >> n; if (n <= 2) { cout << -1 << endl; } else { long long int i; for (i = n; i >= 1; i--) { cout << i << ; } cou...