text
stringlengths
59
71.4k
// Part of NeoGS project // // Z80 clock switch and nothing more. config_n=coldres_n. // // (c) 2008-2010 NedoPC module GS_cpld( output wire config_n, // ACEX1K config pins input wire status_n, // input wire conf_done, // output wire cs, // input wire init...
#include <bits/stdc++.h> using namespace std; int n, val[200100], m; set<pair<int, int> > s[200100]; struct opt { int tp, x, y; } q[200100]; inline void read(int &x) { x = 0; register char c = getchar(); while (c > 9 || c < 0 ) c = getchar(); while (c >= 0 && c <= 9 ) x = (x ...
#include <bits/stdc++.h> using namespace std; int n; char s[2000011]; int h1[2000011], h2[2000011], p1[2000011], p2[2000011], mod1 = 998244353, mod2 = 1000000007; int geth1(int L, int R) { return (h1[R] - h1[L - 1] * 1ll * p1[R - L + 1] % mod1 + mo...
#include <bits/stdc++.h> using namespace std; const int X = 1e5 + 9; const long long inf = (1ll << 60); int n, sum, a[109], b[109], c[109]; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; b[a[i]]++; } for (int i = 0; i < n; i++) { cin >> a[i]; c[a[i]]+...
#include <bits/stdc++.h> using namespace std; vector<int> arr; int n, k; long long sum[5500]; double mx = -1e9; int main() { cin >> n >> k; for (int x, i = 1; i <= n; i++) { cin >> x; arr.push_back(x); sum[i] = sum[i - 1] + x; } for (int i = 1; i <= n; i++) { for (int...
module vexriscv_wrapper ( input clk, output rst_out, // PORTA inout[7:0] porta, // PORTB inout[7:0] portb, // SDCARD input sdcard_sck, input sdcard_mosi, output ...
/** * 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> int main() { int n, m; scanf( %d%d , &n, &m); int min_row = n, max_row = 0, min_col = m, max_col = 0; char S[105][105]; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { scanf( %c , &S[i][j]); if (S[i][j] == * ) { min_row = 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...
/* This file is part of JT12. JT12 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 is distributed in the hope tha...
#include <bits/stdc++.h> using namespace std; const int M = INT32_MAX; const int NMAX = 10007; int main() { cin.tie(0); cin.sync_with_stdio(0); cout.precision(30); string z[2]; cin >> z[0] >> z[1]; int n; cin >> n; cout << z[1] << << z[0] << endl; for (int i = 0; i < n; i...
/* Copyright (c) 2015-2016 Alex Forencich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distri...
#include <bits/stdc++.h> using namespace std; const int inf = 1e9; const int M = 1000010; const int MAX = M; struct BIT { int bit[MAX + 1], N; BIT() {} BIT(int N) : N(N) { memset(bit, 0, sizeof(bit)); } int sum(int i) { i++; int ret = 0; while (i) { ret += bit[i]; ...
#include <bits/stdc++.h> using namespace std; int main() { int n, a; long long k; cin >> n >> k; vector<int> arr(n), c(n); for (int i = 0; i < n; i++) { cin >> arr[i]; } cin >> a; for (int i = 0; i < n; i++) { cin >> c[i]; } set<int> m; long long ans = 0; ...
#include <bits/stdc++.h> int p[100100]; void solve(int n, int m) { int i, j, k, x, s = 0, l = 0, r = n; for (i = 0; i < 100100; i++) p[i] = 0; for (i = 0; i <= n; i++) p[i] = i; for (k = 0; k < m; k++) { scanf( %d , &x); if (x == 1) { scanf( %d , &x); if (s == 0) { ...
#include <bits/stdc++.h> using namespace std; int n, m1, m2; long long C[4005][4005], f[4005], ret; long long MOD = 1000000009; int main() { for (int i = 0; i <= 4000; i++) { C[i][0] = C[i][i] = 1; for (int j = 1; j <= i; j++) C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % MOD; } ...
//========================================== // Function : Code Gray counter. // Coder : Alex Claros F. // Date : 15/May/2005. //======================================= `timescale 1ns/1ps module graycounter #(parameter COUNTER_WIDTH = 2) (output reg [COUNTER_WIDTH-1:0] GrayCount_out, //'Gray'...
#include <bits/stdc++.h> #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize( Ofast ) #pragma GCC optimize( inline ) #pragma GCC optimize( -fgcse ) #pragma GCC optimize( -fgcse-lm ) #pragma GCC optimize( -fipa-sra ) #pragma GCC optimize( -ftree-pre ) #pragma GCC optimize( -ftree-vrp )...
// File: memory_array.v // Generated by MyHDL 0.10 // Date: Mon Aug 27 20:10:17 2018 `timescale 1ns/10ps module memory_array ( data_in, fifo_we, wptr, rptr, data_out, clk, clear ); // Input: // data_in(8bit): data to be writen // fifo_we(bool): write enable // wptr(5bit): wri...
// Wrapper for aeMB core: // Drive wb_cyc_o (just tied to wb_stb_o for now) // Make input reset active high (like the signal name makes it sound....) // No longer needed // Make it big-endian like the standard MicroBlaze module aeMB_core_BE #(parameter ISIZ=32, parameter DSIZ=32, parameter MUL=0, par...
module basic_ShieldCtrl( //Avalon System control signal. input rsi_MRST_reset, // reset_n from MCU GPIO input csi_MCLK_clk, //Avalon-MM Control. input [31:0] avs_ctrl_writedata, output [31:0] avs_ctrl_readdata, input [3:0] avs_ctrl_byteenable, input avs_ctrl_write, input avs_ctrl_read, ou...
#include <bits/stdc++.h> using namespace std; const int N = 5010; const int mod = 998244353; long long d[N][N]; long long p[N]; long long inv[N]; long long _inv[N]; long long f[N]; void init(int n) { d[0][0] = 1; for (int i = 1; i <= n; i++) { for (int j = 1; j <= i; j++) { d[i][...
`define ADDER_WIDTH 096 `define DUMMY_WIDTH 128 `define 2_LEVEL_ADDER module adder_tree_top ( clk, isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0, isum0_1_0_1, isum0_1_1_0, isum0_1_1_1, sum, ); input clk; input [`ADDER_WIDTH+0-1:0] isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0,...
// megafunction wizard: %RAM: 2-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: sync_dpram_32W_256D.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ====================...
`include "bsg_nonsynth_dramsim3.svh" `define dram_pkg bsg_dramsim3_hbm2_8gb_x128_pkg module testbench(); bit clk; bit reset; bsg_nonsynth_clock_gen #( .cycle_time_p(1000) ) cg0 ( .o(clk) ); bsg_nonsynth_reset_gen #( .reset_cycles_lo_p(0) ,.reset_cycles_hi_p(10) ) rg0 ( .clk_i(cl...
#include <bits/stdc++.h> using namespace std; int n, kezd[200002], veg[200002], pos[200002], inv[200002], x, csa, csb; vector<pair<pair<int, int>, int> > sz; vector<int> v; priority_queue<pair<int, int> > q; void p() { for (int i = 1; i <= n; i++) inv[pos[i]] = i; for (int i = 1; i <= n; i++) cout <...
/***************************************************************************** * File : processing_system7_bfm_v2_0_gen_clock.v * * Date : 2012-11 * * Description : Module that generates FCLK clocks and internal clock for Zynq BFM. * *****************************************************************************/...
#include <bits/stdc++.h> using namespace std; const double PI = 3.1415926535897932384626433; int MOD = 0; int pl(int v1, int v2) { int res = v1 + v2; if (res < 0) res += MOD; else if (res >= MOD) res -= MOD; return res; } int mul(const int v1, const int v2) { return (int)((1LL * ...
/** * 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 `include "../src/axis_blender.v" module test_axis_blender( ); parameter integer C_CHN_WIDTH = 8; parameter integer C_S0_CHN_NUM = 1; parameter integer C_S1_CHN_NUM = 3; parameter integer C_ALPHA_WIDTH = 8; parameter integer C_S1_ENABLE = 1; ...
`timescale 1ns / 1ps `define SIMULATION module peripheral_bt_TB; reg clk; reg rst; reg reset; reg start; reg [15:0]d_in; reg cs; reg [1:0]addr; reg rd; reg wr; wire [15:0]d_out; peripheral_bt uut (.clk(clk) , .rst(reset) , .d_in(d_in) , .cs(cs) , .addr(addr) , .rd(rd) , .wr(wr), ...
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { return (b != 0 ? gcd(b, a % b) : a); } int lcm(int a, int b) { return (a / gcd(a, b) * b); } int R[] = {1, -1, 0, 0, 1, -1, -1, 1}; int C[] = {0, 0, 1, -1, 1, -1, 1, -1}; int KR[] = {-2, -2, -1, 1, 2, 2, -1, 1}; int KC[] = {1, -1, 2, 2,...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); double a[20] = {0}; int i = 0; for (i = 0; i < 16; i++) cin >> a[i]; double x1 = a[0], x2 = a[2], x3 = a[4], x4 = a[6]; double y1 = a[1], y2 = a[3], y3 = a[5], ...
#include <bits/stdc++.h> using namespace std; typedef struct st { int a; string b; } st; bool func(st x, st y) { if (x.a == y.a) return x.b > y.b; else return x.a > y.a; } int main() { string a; cin >> a; int sum1 = 0; for (int i = 0; i < a.size(); i++) sum1 += a[...
#include <bits/stdc++.h> using namespace std; static const double EPS = 1e-10; template <typename T, typename S> vector<T>& operator<<(vector<T>& a, S b) { a.push_back(b); return a; } template <typename T> void operator>>(vector<T>& a, int b) { while (b--) if (!a.empty()) a.pop_back(); ...
// ---------------------------------------------------------------------- // Copyright (c) 2015, The Regents of the University of California All // rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met:...
//**************************************************************************************************** //*---------------Copyright (c) 2016 C-L-G.FPGA1988.lichangbeiju. All rights reserved----------------- // // -- It to be define -- // -- ...
// Copyright (c) 2015 CERN // @author 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) // ...
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize( Ofast,no-stack-protector,unroll-loops,fast-math ) const int maxn = 1e6 + 50; int seg[4 * maxn], ans[maxn], last_pos[maxn], next_pos[maxn]; int n, m; vector<int> v, get_val, partial_xor; vector<pair<pair<int, int>, int> > ques; void upda...
#include <bits/stdc++.h> #pragma comment(linker, /stack:200000000 ) #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; bool replace(std::string& str, const std::string& from, const std::string& to) { size_t start_pos = str.find...
// *************************************************************************** // *************************************************************************** // Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved. // // In this HDL repository, there are many different and unique modules, consisting // of...
/******************************************************************************* * This file is owned and controlled by Xilinx and must be used solely * * for design, simulation, implementation and creation of design files * * limited to Xilinx devices or technologies. Use with non-Xilinx ...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of avfb_chip // // Generated // by: wig // on: Tue Apr 25 19:40:28 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; long long _pow(long long a, long long b, long long m) { if (b == 0) return 1; long long t = _pow(a, b / 2, m); t = (t * t) % m; if (b & 1) return (t * a) % m; else return t; } int main(int argc, char *argv[]) { int n; cin >> n...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 00:10:27 04/07/2016 // Design Name: // Module Name: forwardUnit // Project Name: // Target Devices: // Tool versions: // Description: // // Dep...
#include <bits/stdc++.h> #pragma GCC optimize( O3,inline,unroll-loops ) using namespace std; int f[4020][4020][2][2]; inline int Mod(int x) { return x + ((x >> 31) & 1000000007); } inline void Modadd(int &x, int y) { x = Mod(x + y - 1000000007); return; } int Modular(string &a, int b) { string...
#include <bits/stdc++.h> using namespace std; struct fenwick_tree_1D { long long n, log_n; vector<long long> tree; fenwick_tree_1D(long long _n) : n(_n), log_n((long long)(log2(_n) + 1.0L)), tree(_n + 5) {} void update(long long x, long long v) { while (x <= n) { tree[x] += v; ...
#include <bits/stdc++.h> using std::abs; using std::bitset; using std::cerr; using std::cin; using std::copy; using std::cout; using std::deque; using std::endl; using std::fill; using std::fixed; using std::greater; using std::iota; using std::istream; using std::lower_bound; using std::m...
// ------------------------------------------------------------- // // File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\velocityControlHdl\velocityControlHdl_Control_Velocity.v // Created: 2014-08-25 21:11:09 // // Generated by MATLAB 8.2 and HDL Coder 3.3 // // --------------------------------------------------...
module acl_iface_system ( config_clk_clk, reset_n, kernel_clk_clk, kernel_clk_snoop_clk, kernel_mem0_waitrequest, kernel_mem0_readdata, kernel_mem0_readdatavalid, kernel_mem0_burstcount, kernel_mem0_writedata, kernel_mem0_address, kernel_mem0_write, kernel_mem0_read, kernel_mem0_byteenable, kernel_mem0_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...
#include <bits/stdc++.h> using namespace std; const long long oo = 1000000000000000000; long long sum, ans = 0, mx = 0, mn = 1000000000, num, pos; vector<int> v[100001]; long long int a[100001], mxx[100001]; map<int, int> mp[100001]; void unin(int x, int y) { if (mp[x].size() < mp[y].size()) { m...
`timescale 1ns/1ps /*************************************************************************** Name: Date: 7/11/2016 Founction: Send out capture value Note: ****************************************************************************/ module captuer_tx( clk,rst_n,tx_start,capture_ready,periodcounter,tx_data,counter,l...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n, m; cin >> n >> m; vector<vector<char>> arr(n + 2, vector<char>(m + 2)); for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { cin...
module Mod_Teste_Template( 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, output [6:0] HEX6, output [6:0] HEX7, output [8:0] LEDG, output [17:0] LEDR, output LCD_ON, // ...
#include <bits/stdc++.h> using namespace std; int n; long long a, b, w, x; int main() { while (scanf( %d , &n) != EOF) { cin >> a >> b; for (int i = 1; i <= n; i++) { scanf( %I64d , &w); x = w * a / b; x = x * b; printf( %I64d%c , (w * a - x) / a, n [i == n]); ...
// (C) 2001-2017 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...
#include <bits/stdc++.h> using namespace std; int d[10010][8]; int d1[8]; int p[3][10010]; int n; vector<int> var; int MD = 1000000007; int mod(long long a) { if (a % MD < 0) return a % MD + MD; else return a % MD; } void put(int i, int prof) { if (prof == 0) { d[i + 1]...
// ECE 429 module memory(clock, address, data_in, access_size, rw, enable, busy, data_out); parameter data_width = 32; parameter address_width = 32; parameter depth = ; // -1 for 0 based indexed parameter bytes_in_word = 4-1; parameter bits_in_bytes = 8-1; parameter BYTE = 8; parameter start_addr = 32'h80020000; // ...
`timescale 1ns/10ps module system_pll_0( // 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_multiplier("false...
#include <bits/stdc++.h> using namespace std; int m, n; string bs[50]; long long component[1000]; long long combo[1001][1001]; long long pseudopart[1001]; bool visited[1000]; int main() { cin >> m >> n; for (int i = 0; i < n; i++) cin >> bs[i]; for (int i = 0; i < m; i++) for (int j = ...
#include <bits/stdc++.h> using namespace std; int main() { string Scale, left, right, rest_elements; int Slash; cin >> Scale; Slash = Scale.find( | ); left = Scale.substr(0, Slash); right = Scale.substr(Slash + 1, Scale.size()); cin >> rest_elements; for (auto i : rest_elements) ...
// Copyright (c) 2000-2009 Bluespec, Inc. // 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, pub...
//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; namespace Base { const int inf = 0x3f3f3f3f, INF = 0x7fffffff; const long long infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll; template <typename T> void read(T &x) { x = 0; int fh = 1; double num = 1.0; char ch = getchar(); while...
// (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 ...
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2014 Francis Bruno, All Rights Reserved // // 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 Found...
#include <bits/stdc++.h> using namespace std; int n; set<int> S[100001]; int main() { scanf( %d , &n); set<int> s; int x, k; for (int i = 0; i < n; ++i) { scanf( %d%d , &x, &k); if (x && S[k].find(x - 1) == S[k].end()) { puts( NO ); return 0; } S[k].insert...
/** * 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; struct Number { array<int, 4> powers = {{0, 0, 0, 0}}; Number() {} Number(int a) { if (a != -1) powers[a]++; } long double log_value() const { if (powers[0] > 0) return -INFINITY; return powers[2] * log(2L) + powers[3] * log(3L); ...
#include <bits/stdc++.h> using namespace std; void solve() { int n, x, y, c1 = 0, c2 = 0, m; cin >> n; for (int i = 0; i < n; i++) { cin >> x >> y; if (x > 0) c1++; else c2++; } m = min(c1, c2); if (m <= 1) cout << YES << endl; else cout <<...
#include <bits/stdc++.h> using namespace std; const int maxn = 3e5 + 10, maxk = 1e6 + 10; int n, k, A[maxn], cnt[maxk], sum[maxk]; int32_t main() { scanf( %d%d , &n, &k); for (int i = int(0); i < int(n); i++) { scanf( %d , A + i); cnt[A[i]]++; } sort(A, A + n); for (int i = int(1...
#include <bits/stdc++.h> using namespace std; int store[20][1 << 20]; struct trie { int k; struct Node { Node* ch[2]; Node() { ch[0] = ch[1] = NULL; } }; Node* root; trie(int k) : k(k) { root = new Node(); } void insert(int x) { Node* cur = root; for (int i = k - 1;...
#include <bits/stdc++.h> using namespace std; int a, b, c; int f[2001 * 2001]; int _GCD[2001][2001]; int GCD(int a, int b) { if (_GCD[a][b]) return _GCD[a][b]; if (!b) return a; return _GCD[a][b] = GCD(b, a % b); } int phi(int x) { if (x & 1) return -1; return 1; } int main() { ...
`timescale 1ns / 1ps `include "collaterals.v" module io ( input wire Clock, input wire Reset, input wire [5:0] iP, //Pressed button output wire [5:0] oP, //[5:4] most be triggered before [3:0] output wire oIE //Enable interruption $FFFF ); wire [5:0] wiPlast; w...
#include <bits/stdc++.h> using namespace std; const long long INF = 501; const long long DIM = 3e5 + 1; int in, n, t, a[DIM]; int main() { ios_base::sync_with_stdio; cin.tie(0); cout.tie(0); in = scanf( %d , &t); while (t--) { in = scanf( %d , &n); set<int> s; for (int i ...
#include <bits/stdc++.h> using namespace std; const int maxn = 100007; int n, m; long long h[maxn], p[maxn]; bool check(long long time) { int x = 1, old_x; for (int i = 1, _c = n; i <= _c; i++) { if (x > m) return 1; if (p[x] <= h[i]) { if (h[i] - p[x] > time) return 0; old...
#include <bits/stdc++.h> using namespace std; int main() { vector<int> num; int n; cin >> n; int k = -1, tmp; while (n > 0) { tmp = n % 10; num.push_back(tmp); if (tmp > k) k = tmp; n /= 10; } cout << k << endl; bool flag = true; bool main = true; whil...
#include <bits/stdc++.h> using namespace std; int main() { int n, max = 0; cin >> n; int arr[n]; long long ans = 0; for (int i = 0; i < n; i++) { cin >> arr[i]; if (arr[i] > max) { max = arr[i]; } } for (int i = 0; i < n; i++) { ans += max - arr[i]; } ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int xa, ya, xb, yb, n; cin >> xa >> ya >> xb >> yb >> n; vector<int> X(n), Y(n), R(n); for (int i = 0; i < n; ++i) cin >> X[i] >> Y[i] >> R[i]; if (xa > xb) swap(xa, xb); if (ya > yb) swap...
/* * 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> const int MAXN = 50 + 10; bool row[MAXN]; bool column[MAXN]; int main() { int n, x, y; std::cin >> n; for (int i = 0; i <= n * n; i++) { std::cin >> x >> y; if (row[x - 1] == false && column[y - 1] == false) { row[x - 1] = true; column[y - 1] = tr...
//***************************************************************************** // (c) Copyright 2008-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 TOUR = 1 << 18, MOD = 1e9 + 7; int Add(int a, int b) { a += b; if (a >= MOD) a -= MOD; return a; } int Sub(int a, int b) { a -= b; if (a < 0) a += MOD; return a; } int Mul(int a, int b) { return (int)(((long long)a * b) % MOD)...
#include <bits/stdc++.h> using namespace std; int v[1000005]; long long int l[1000005]; long long int r[1000005]; int main(void) { int n, m; int sum; scanf( %d %d , &n, &m); for (int i = 0; i < n; i++) { scanf( %d , &v[i]); } l[0] = 0; sum = 0; for (int i = 1; i < n; i+...
/* * Copyright (c) 2003 Stephen Williams () * * 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; int a[210000]; long long dp[210000][2]; const long long INF = 1LL << 60; int N; void init() { for (int i = 0; i < 210000; i++) for (int j = 0; j < 2; j++) dp[i][j] = INF; } long long solve(int x, bool t) { if (x <= 0 || x > N) return 0; 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 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 la...
//wb_hs_demo.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 rights t...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
module test_bench(clk, rst); input clk; input rst; wire [31:0] wire_39069600; wire wire_39069600_stb; wire wire_39069600_ack; wire [31:0] wire_39795024; wire wire_39795024_stb; wire wire_39795024_ack; wire [31:0] wire_39795168; wire wire_39795168_stb; wire wire_39795168_ack; ...
// ************************************************************************** // $Header: /var/lib/cvs/dncvs/FPGA/dini/misc/resync.v,v 1.7 2015/04/07 22:03:42 bpoladian Exp $ // ************************************************************************** // $Log: resync.v,v $ // Revision 1.7 2015/04/07 22:03:42 bpoladi...
#include <bits/stdc++.h> using namespace std; template <typename T> std::ostream& operator<<(std::ostream& str, const std::vector<T>& v) { str << [ ; for (auto n : v) str << n << , ; str << ] ; return str; } template <typename K, typename V> std::ostream& operator<<(std::ostream& str, co...
#include <bits/stdc++.h> using namespace std; const int N = 2e5; int xp, yp, xc, yc; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> xp >> yp >> xc >> yc; vector<pair<int, int>> store; while (xc != 0 || yc != 0) { store.push_back({xc, yc}); xc--; ...
/* * 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 la...