text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int main() { int arr[1000]; int num; cin >> num; for (int i = 0; i < num; i++) { cin >> arr[i]; arr[num + i] = arr[i]; } int ans = 360; for (int i = 0; i < num; i++) { int temp = 0; for (int j = i; j < num * 2; j++) { ... |
#include <bits/stdc++.h> using namespace std; const int oo = 1e9 + 9; const long long inf = 1e18 + 18; const int max6 = 1e6 + 6; const int modx = 1e9 + 123; const int mody = 997; const int base = 137; int a[max6], dd[max6], cnt[max6]; int main() { int t; cin >> t; while (t--) { int n... |
#include <bits/stdc++.h> using namespace std; struct query { int Q, id; long long res; }; const int Nmax = 200001; int n, m, parent[Nmax], Rank[Nmax]; vector<pair<int, pair<int, int> > > edge; bool cmpQ(const query &q1, const query &q2) { return q1.Q < q2.Q; } bool ret(const query &q1, const que... |
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;
... |
/***********************************************************************************************************************
* Copyright (C) 2017 Andrew Zonenberg and contributors *
* ... |
/**
* 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 top
(
input wire clk,
input wire rx,
output wire tx,
input wire [15:0] sw,
output wire [15:0] led
);
parameter SRL_COUNT = 4;
parameter PRESCALER = 4;
// UART loopback
assign tx = rx;
// ============================================================================
// Reset
reg [... |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: ctrl_boot.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ==================... |
module control_unit (
input wire clk,
input wire rst_n,
// to UART receiver
input wire[7:0] cmd,
input wire rx_rdy,
input wire tx_rdy,
output reg cmd_oen = 1,
output reg data_wen = 1,
... |
#include <bits/stdc++.h> using namespace std; long long int insig; void Out(vector<long long int> x) { for (long long int i = 0; i < x.size(); i++) { cout << x[i] << ; } cout << endl; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long int N; ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m; string input; cin >> n >> m; vector<vector<int> > nodes(n, vector<int>(26)); vector<vector<int> > G(n); int indegree[n]; memset(indegree, 0, sizeof(indegree)); ... |
module opicorv32_rf_wrap (
ra2,
ra1,
d,
wa,
wr,
resetn,
clk,
q1,
q2
);
input [5:0] ra2;
input [5:0] ra1;
input [31:0] d;
input [5:0] wa;
input wr;
input resetn;
input clk;
output [31:0] q1;
output [31:0] q2;
/* signal declarations */
wire... |
`default_nettype none
`timescale 1ns / 1ps
module sia(
input clk_i,
input reset_i,
input [3:1] adr_i,
input we_i,
input cyc_i,
input stb_i,
input [1:0] sel_i,
input [SRW:0] dat_i,
output [SRW:0] dat_o,
output ack_o,
output stall_o,
output irq_o,
input rxd_i,
input rxc_i,
output txd_o,
outp... |
// (c) Copyright 1995-2015 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is not a license and does not grant ... |
#include <bits/stdc++.h> using namespace std; long long k, d, t; int main() { scanf( %lld%lld%lld , &k, &d, &t); t *= 2; long long round = ceil((double)k / d) * d; long long num = k * 2 + (round - k); long long cnt = t / num; long long left = t - cnt * num; double ans = 0.0; if (le... |
#include <bits/stdc++.h> using namespace std; int q[1000005]; long long i, j, t, tot, C, cnt; long long loc[10005], op[10005]; long long n, m, k, H, x, y, ans, tmp; long long a[100005], w[100005], e[25], dis[10005], heap[10005]; bool used[100005], f[10005]; map<long long, long long> A; map<long long, ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21:50:22 05/08/2016
// Design Name:
// Module Name: xorshift
// 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 law... |
#include <bits/stdc++.h> using namespace std; double m1 = 200.0, m2 = 0.0, DV; int card, n, k, Q, getcard; int a[110], vs[110], b[110], len = 0; int sum = 0, tmp; int main() { memset(vs, 0, sizeof(vs)); scanf( %d%d , &n, &k); card = (int)(n / k); for (int i = 1; i <= n; ++i) scanf( %d , &a[i... |
#include <bits/stdc++.h> int main() { int q; std::cin >> q; while (q--) { int n, ans(0); std::cin >> n; std::set<std::string> check, p; std::string s; std::vector<std::string> res, a(n); for (int i = 0; i < n; i++) { std::cin >> a[i]; check.insert(a[i]);... |
#include <bits/stdc++.h> using namespace std; const int N = 200005; const int inf = 1e9 + 7; int main() { int n; scanf( %d , &n); while (n--) { int x; scanf( %d , &x); if (x <= 3 || x == 5 || x == 7 || x == 11) puts( -1 ); else { int ans = 0, tg = x & 3; ... |
/**
* 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... |
//
// atabuf.v -- parallel ATA data buffer
//
module ata_buffer (clk,
bus_write, bus_addr, bus_din, bus_dout,
ata_write, ata_addr, ata_din, ata_dout);
input clk;
// bus interface
input bus_write;
input [11:2] bus_addr;
input [31:0] bus_din;
output [31:0] b... |
/**
* 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 inf = 1000000001; void run_case() { long long n; cin >> n; vector<pair<long long, long long>> v; for (long long i = 0; i < n; i++) { long long x; cin >> x; v.push_back({x, i}); } sort(v.begin(), v.end()); v... |
// chris_slave.v
// This file was auto-generated as a prototype implementation of a module
// created in component editor. It ties off all outputs to ground and
// ignores all inputs. It needs to be edited to make it do something
// useful.
//
// This file will not be automatically regenerated. You should check it... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19:52:27 02/29/2016
// Design Name: FSM
// Module Name: C:/Users/Jafet/Documents/Proyectos Dis.Sist.Digitales/I_Proyecto_Laboratorio_Sistemas_Digitales/FSM_Testbench.... |
module top;
reg passed;
parameter zero = 1'b0;
parameter one = 1'b1;
parameter highz = 1'bz;
parameter undef = 1'bx;
initial begin
passed = 1'b1;
if (&zero !== 1'b0) begin
$display("FAILED const. reduction & with input 1'b0, expected 1'b0, ",
" got %b", &zero);
passed = ... |
/**
* 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() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); long long int n, o = 0, t = 0; cin >> n; for (long long int i = 0; i < n; i++) { long long int x; cin >> x; if (x == 1) o++; else t++; } i... |
#include <bits/stdc++.h> using namespace std; void err(istream_iterator<string> it) {} template <typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cerr << *it << = << a << endl; err(++it, args...); } mt19937 rng(chrono::steady_clock::now().time_since_epoch(... |
#include <bits/stdc++.h> using namespace std; int n, t, k, cnt = 0; int a[200005], st[200005]; struct hehe { int x, y; } e[200005]; void add(int x, int y) { cnt++; e[cnt].x = x; e[cnt].y = y; } void solve() { int i, j; int minn = 1, maxx = 1; a[0] = 1; st[0] = 1; for ... |
`default_nettype none
// ============================================================================
module top
(
input wire clk,
input wire [7:0] sw,
output wire [7:0] led,
input wire jc1,
output wire jc2,
input wire jc3,
output wire jc4
);
// =================================================================... |
#include <bits/stdc++.h> using namespace std; int n, t, b[100020], cnt, p, q; char s[100020], s1[100020], s2[100020]; char chose(char x, char y) { if (x != a && y != a ) return a ; else if (x != b && y != b ) return b ; else return c ; } int main() { scanf( %d%d , ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<string> s(n); for (int i = 0; i < n; ++i) cin >> s[i]; int answer = 0; for (int col = 0; col < (int)s[0].size(); ++col) { bool is_sorted = true; for (int i = 0; i < n - 1; ++i) { if... |
#include <bits/stdc++.h> using namespace std; int a[1000010], b[1000010]; int f[1000010], g[1000010]; int tmp[1000010]; int ansf[1000010], ansg[1000010]; int main() { int sv, n, m; scanf( %d %d , &sv, &n); int p = 0, q = 0; for (int i = 1; i <= n; i++) { int x; scanf( %d , &x); ... |
#include <bits/stdc++.h> using namespace std; unsigned long long lvl_len(int lvl) { static long long len[64] = {0}; if (len[lvl]) return len[lvl]; else { len[1] = 1; for (int i = 2; i < 64; ++i) len[i] = len[i - 1] * 2 + 1; } return len[lvl]; } void rec(int lvl, unsigned lo... |
#include <bits/stdc++.h> using namespace std; bool odd(int N) { while (N < 0) { N += 2; } return N % 2 == 1 ? true : false; } bool even(int N) { while (N < 0) { N += 2; } return N % 2 == 0 ? true : false; } int main() { string s, t; cin >> s >> t; int N = s.si... |
// ====================================================================
// Radio-86RK FPGA REPLICA
//
// Copyright (C) 2011 Dmitry Tselikov
//
// This core is distributed under modified BSD license.
// For complete licensing information see LICENSE.TXT.
// -----------------------------... |
#include <bits/stdc++.h> using namespace std; void inp(long long &n, long long &m, vector<long long> &v, vector<pair<signed, signed> > &rope) { cin >> n >> m; v.resize(n + 1); rope.resize(m + 1); for (long long i = 1; i <= n; ++i) { cin >> v[i]; } for (long long i = 1; i <= ... |
// -*- Mode: Verilog -*-
// Filename : fw_interface.v
// Description : Firmware Testing Interface
// Author : Philip Tracton
// Created On : Wed Dec 21 14:03:49 2016
// Last Modified By: Philip Tracton
// Last Modified On: Wed Dec 21 14:03:49 2016
// Update Count ... |
#include <bits/stdc++.h> using namespace std; template <class n, class second> ostream &operator<<(ostream &p, pair<n, second> x) { return p << < << x.first << , << x.second << > ; } template <class n> auto operator<<(ostream &p, n y) -> typename enable_if<!is_same<n, string>::value, ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n == 2) { cout << white n1 2 n ; } else if (n % 2 == 0) { cout << white n1 2 n ; } else { cout << black n ; } } |
#include <bits/stdc++.h> using namespace std; void solve(long long case_no) { long long n; cin >> n; vector<long long> a(n); for (long long i = 0; i < n; ++i) cin >> a[i]; map<long long, long long> mp; long long mx = LONG_LONG_MIN; for (long long i = 0; i < n; ++i) { long long x = ... |
#include <bits/stdc++.h> using namespace std; const long double PI = acos(-1); const long double eps = 0.0000000001; const long long INF = 0x3fffffffffffffff; long long a[200005], sum[200005], n, q, x, y; long long lowbit(long long now) { return now & -now; } void add(long long pos, long long v) { whi... |
#include <bits/stdc++.h> using namespace std; int r[305]; int main() { int p, n; cin >> p >> n; int a[n + 5]; for (int i = 1; i <= n; i++) { cin >> a[i]; } int sum = 0, c = 0, f = -1; for (int i = 1; i <= n; i++) { c = a[i] % p; if (r[c] == 0) { f = -1; ... |
#include <bits/stdc++.h> using namespace std; int main(int argc, char* argv[]) { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; int minr = 1e9 + 2; int maxl = 0; for (int i = 0; i < n; i++) { int l, r; cin >> l >> r; if (l > maxl) { maxl = l; ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); int n, x; cin >> n >> x; long long sum = 0; for (int i = 0; i < n; i++) { long long a; cin >> a; sum += a; } if (sum + n - 1 == x) return 0 * puts( YES ); puts( NO ); return ... |
#include <bits/stdc++.h> using namespace std; vector<int> gr[50005]; int parent[50005]; void dfs(int src, int par) { parent[src] = par; for (auto nbr : gr[src]) { if (nbr != par) dfs(nbr, src); } } int main() { int n, x, y; cin >> n >> x >> y; for (int i = 1; i <= n; i++) { ... |
/*
stage_wrapper_tb.v
Abstract: оболочка для блока при конвееризации
*/
`include "vconst.v"
`timescale 1 ns / 100 ps
`define WIDTH 8
`define LEN_WORD 15
`define IN_WIDTH 8
`define OUT_WIDTH 8
module stage_wrapper_tb;
reg clk_tmp, rst, clk_ena;
wire clk_t;
wire clk;
//wire [`WIDTH-1:0] rsin; // вх... |
// (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 main() { std::ios::sync_with_stdio(0); long long n, m; cin >> n >> m; vector<long long> a, b; vector<long long> sum1, sum2; long long prev = 0; for (int i = 0; i < n; i++) { long long x; cin >> x; prev += x; a.push... |
/*
* 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 = 1e9 + 7; const double PI = acos(-1); long long power(long long x, long long y) { if (y == 0) return 1; else if (y == 1) return x; long long r = power(x, y / 2); if (y % 2 == 0) return (r * r); else re... |
#include <bits/stdc++.h> using namespace std; int main() { int bench, more, temp; vector<int> v; cin >> bench >> more; for (int i = 0; i < bench; i++) { cin >> temp; v.push_back(temp); } int min, max = *max_element(v.begin(), v.end()); ; min = *min_element(v.begin(), v.en... |
#include <bits/stdc++.h> using namespace std; int n; string s; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> s; s = ? + s + ? ; int c = 0; bool flag = true; for (int i = 1; i <= n; i++) { if (s[i] == ? ) { c++; if (s[i -... |
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017
// Date : Wed Sep 20 21:28:52 2017
// Host : EffulgentTome running 64-bit major release ... |
#include <bits/stdc++.h> using namespace std; using namespace std; long long k, p; long long getZCY(long long x) { long long res = x; while (x) { res *= 10LL; res += x % 10; x /= 10; } return res; } int main() { scanf( %I64d , &k); scanf( %I64d , &p); long long ... |
#include <bits/stdc++.h> using namespace std; vector<int> a[200005], b; set<int> c1; int n, k, p, f[200005], x[200005], c[200005], c2[200005]; int getdeepth(int i) { for (vector<int>::iterator j = a[i].begin(); j != a[i].end(); j++) if ((*j) != f[i]) { f[*j] = i; int x = getdeepth(*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 la... |
module my_rand(clk,
rst,
seed0,
num
);
input clk;
input rst;
input [31:0] seed0;
output [31:0] num;
reg [31:0] num;
reg [31:0] seed;
reg [31:0] seed1,seed2;
reg [5:0] rst_d;
always @(posedge clk) begin
rst_d <= {rst_d[4:0], rst};
end
wire rnd_rst = | r... |
#include <bits/stdc++.h> struct Edge { long long to, dis, next; } edge[100100]; long long n, num_edge; long long first1[100100]; long long a[100100], b[100100]; double tem; void dfs(long long x, long long fa, long long p) { long long k = first1[x]; while (k != 0) { dfs(edge[k].to, x, edg... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5, INF = 1e9 + 7; long long ans[N]; int main() { long long p, k; cin >> p >> k; long long tmp = -k; long long idx = 0; while (p != 0) { long long rem = p % tmp; p /= tmp; if (rem < 0) rem += k, p++; ans... |
//`#start header` -- edit after this line, do not edit this line
// ========================================
// Copyright 2013 David Turnbull AE9RB
//
// 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 L... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1000 * 100 * 2 + 152; long long n, m, x, y, z, q, mark[maxn], k = 1, par1[maxn], sum[maxn], h[maxn]; pair<long long, long long> par[17][maxn]; vector<pair<long long, long long> > v[maxn]; pair<long long, pair<long long, long long> > edg[maxn]; ... |
module top;
reg pass;
wire [2:-1] vec1;
wire [2:-1] vec2;
wire [2:-1] vec3;
wire [2:-1] vec4;
wire [2:-1] vec5;
wire [2:-1] vec6;
assign vec1 = 4'bxxxx;
assign vec2 = 4'bxxxx;
assign vec3 = 4'bxxxx;
assign vec4 = 4'bxxxx;
assign vec5 = 4'bxxxx;
assign vec6 = 4'bxxxx;
assign vec1[1'bx] = 1'... |
// Problem: A. Robot Program // Contest: Codeforces - Educational Codeforces Round 98 (Rated for Div. 2) // URL: https://codeforces.com/contest/1452/problem/A // Memory Limit: 256 MB // Time Limit: 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> usi... |
#include <bits/stdc++.h> using namespace std; int n, a[200015]; char s[200015]; vector<pair<int, int> > ans; int main() { scanf( %d , &n); for (int i = (1); i <= (n); i++) scanf( %d , &a[i]); scanf( %s , s + 1); sort(a + 1, a + n + 1); int lp = 1, rp = n; for (int i = (1); i <= (n); i+... |
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize( O3 ) template <class c> struct rge { c b, e; }; template <class c> rge<c> range(c i, c j) { return rge<c>{i, j}; } template <class c> auto dud(c* x) -> decltype(cerr << *x, 0); template <class c> char dud(...); struct ... |
#include <bits/stdc++.h> using namespace std; double dist[5001][5001]; double x[5001], y[5001], z[5001]; int n; double sqr(double x) { return x * x; } int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> x[i] >> y[i] >> z[i]; for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n;... |
`timescale 1 ns /10 ps
`include "alu.v"
`include "componentes.v"
`include "cpu.v"
`include "cpu_vga.v"
`include "e_s.v"
`include "memprog.v"
`include "memvga.v"
`include "microc.v"
`include "uc.v"
// `include "vga.v"
module cpu_vga_tb;
reg clk, reset;
reg [7:0] e1,e2,e3,e4;
wire [7:0] s1,s2,s3,s4;
wire [5:0]... |
#include <bits/stdc++.h> using namespace std; string s; int dpl[2010], dpr[2010]; int main() { cin >> s; memset(dpr, 0, sizeof(dpr)); memset(dpl, 0, sizeof(dpl)); int i, j, k; for (i = 0; i < s.size(); i++) { for (j = i, k = i; j >= 0 && k < s.size() && s[k] == s[j]; j--, k++) ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 3e3 + 5; const int MOD = 1e9 + 7; int N, M, A, B; int G[MAXN * MAXN], X, Y, Z; int H[MAXN][MAXN]; int P[MAXN][MAXN]; int T[MAXN][MAXN]; long long ans; deque<pair<int, int> > qu; void reset() { qu.clear(); } void push(int v, int p) { ... |
// file: main_pll.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 ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using pll = pair<ll, ll>; using dd = long double; namespace { static bool constexpr dbg = 0; ll constexpr N = -999; ll n, k; bool ok(string const &s1, string const &s2) { do { if (dbg) { bool b = (s1.size() == s2.siz... |
#include <bits/stdc++.h> using namespace std; vector<string> ans; bool check(string s, int L, int R) { if (s[L] == 0 ) { if (R == L + 1) { return true; } return false; } int n = 0; for (int i = L; i < R; i++) { n *= 10; n += s[i] - 0 ; } return (n >=... |
#include <bits/stdc++.h> using namespace std; const long double eps = 1e-12; const int maxn = 100000 + 1912; const int MX = 1e6; int n; pair<int, int> a[maxn]; vector<int> p[MX * 2 + 3]; long long res = 0; void ReadData() { scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d%d , &a... |
#include <bits/stdc++.h> using namespace std; struct SCC { vector<pair<int, int>> minmax; int size; SCC(vector<int> v) { minmax.resize(v.size()); for (int i = 0; i < (int)v.size(); i++) { minmax[i].first = v[i]; minmax[i].second = v[i]; } size = 1; } bool ... |
`ifndef _control
`define _control
module control(
input wire [5:0] opcode,
output reg branch_eq, branch_ne,
output reg [1:0] aluop,
output reg memread, memwrite, memtoreg,
output reg regdst, regwrite, alusrc,
output reg jump);
always @(*) begin
/* defaults */
aluop[1:0] <= 2'b10;
alusrc <... |
#include <bits/stdc++.h> using namespace std; int main() { bool flag = 0, flag2 = 0; long long n, m, c = 0; cin >> n >> m; for (long long i = 0; i < n; i++) { for (long long j = 0; j < m; j++) { if (i % 2 != 0 && c % 2 == 0 && j != m - 1) { cout << . ; flag = 1; ... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int n, T, ans; int t[N]; priority_queue<int> pq; int main() { scanf( %d%d , &n, &T); for (int i = 1; i <= n; ++i) { scanf( %d , &t[i]); t[i] = t[i] > i ? t[i] - i : 0; } for (int i = 1; i <= n; ++i) { pq.p... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e6; const int maxv = 4e5; const long long INF = 3e14 + 333; struct Node { int u, v, c; void in() { scanf( %d%d%d , &u, &v, &c); } } wo[maxn]; vector<int> G[maxv], st[maxv], ed[maxv]; int n, m; int dfn = 0; int d[maxv][2]; int ... |
#include <bits/stdc++.h> using namespace std; const long long oo = 0x3f3f3f3f3f3f3f3fll; const int LGN = 25; const int MOD = 1e9 + 7; const int N = 3e5 + 5; int n, a[N], m, l[N], r[N]; int mem[N * LGN], cnt; int* alloc(int x) { int* p = mem + cnt; cnt += x; return p; } struct { int* ... |
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; string A, B; cin >> A >> B; int ans = 0; for (int x = 0; x < N - 1 - x; x++) { vector<char> v; v = {A[x], A[N - 1 - x], B[x], B[N - 1 - x]}; sort(v.begin(), v.end()); if (v[0] == v[1] && v[2] ... |
#include <bits/stdc++.h> using namespace std; long long int i, t = 1, j, temp; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); long long t = 1; while (t--) { long long int n, k = 0; cin >> n; long long int a[n]; map<int, long long int> m; ... |
/*------------------------------------------------------------------------------
* This code was generated by Spiral Multiplier Block Generator, www.spiral.net
* Copyright (c) 2006, Carnegie Mellon University
* All rights reserved.
* The code is distributed under a BSD style license
* (see http://www.opensource.or... |
#include <bits/stdc++.h> using namespace std; char a[1000005], b[1000005], s[1000005]; int k, T, tmp[27], vis[27], p, n, tt[27], vv[27]; bool check(int x, int cas) { memcpy(tt, tmp, sizeof(tt)); memcpy(vv, vis, sizeof(vv)); if (cas == 1) { for (int i = x; i <= n; i++) { if (tt[s[i] - ... |
#include <bits/stdc++.h> using namespace std; unsigned char G[301][301]; unsigned char bv[301]; int ints[301]; int main() { int n; cin >> n; for (register int i = 1; i <= n; i++) cin >> ints[i]; for (register int i = 1; i <= n; i++) { for (register int j = 1; j <= n; j++) { char ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; int a[100005]; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); if (n == 1) { cout << -1 << endl; return 0; } bool flag = true; for (int i = 1; i < n;... |
/*
* period_count_tb.v: Test bench for period_count.v
* author: Till Mahlburg
* year: 2019
* organization: Universität Leipzig
* license: ISC
*
*/
`timescale 1 ns / 1 ps
`ifndef WAIT_INTERVAL
`define WAIT_INTERVAL 100
`endif
`ifndef RESOLUTION
`define RESOLUTION 0.1
`endif
module period_count_tb ();
reg ... |
/*
Copyright (c) 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, distribute,... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, m, *a, q, sum = 0; cin >> n; a = new long long int[n]; for (int i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; } sort(a, a + n); cin >> m; for (int i = 0; i < m; i++) { cin >> q; cout ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2015 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc=0;
reg [63:0] crc;
reg [63:0] sum;
// Take CRC data and apply to test... |
/*
* 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() { ios::sync_with_stdio(0); long long int n, s, p, q; char d; map<long long int, long long int> p1, p2; cin >> n >> s; for (long long int i = 1; i <= n; i++) { cin >> d >> p >> q; if (d == B ) p1[p] += q; else... |
/**
* 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 = 105; int Q[N], S[N], ok[N + N], Sav[N], mat[N + N][N]; int dp[N + N][N]; int solve(int p, int k) { if (ok[p]) return k == 0; if (!k) return 0; if (dp[p][k] != -1) return dp[p][k]; return dp[p][k] = solve(p - 1, k - 1) | solve(p + 1, k... |
//-----------------------------------------------------------------------------
//
// (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... |
/**
* 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
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10:14:01 03/09/2017
// Design Name:
// Module Name: SimpleAI_TB
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
/... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.