text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> template <class T> inline void read(T &x) { x = 0; int f = 0; char ch = getchar(); while (!isdigit(ch)) { f |= ch == - ; ch = getchar(); } while (isdigit(ch)) { x = (x << 1) + (x << 3) + (ch ^ 48); ch = getchar(); } x = f ? -x : x; ... |
#include <bits/stdc++.h> using namespace std; long long n, m, s, tmp1, tmp2; vector<long long> ans; vector<vector<long long>> g(100000); bool vs[2][100000]; bool vs1[100000] = {0}, rc[100000] = {0}; bool a = false, w = false, d = false, t = false; long long cnt = 0; void hasc(long long v) { vs1[v ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
//----------------------------------------------------------------------
// Title : Demo Testbench
// Project : Virtex-6 Embedded Tri-Mode Ethernet MAC Wrapper
// File : demo_tb.v
// Version : 1.5
//-----------------------------------------------------------------------------
//
// (c) Copyright 2009-2... |
module test();
wire a;
tri0 b;
tri1 c;
tri1 d;
tri0 e;
wire f;
wire g;
wire h;
wire i;
tri1 j;
tri0 k;
wire l;
tri0 m;
tri1 n;
assign d = 1'b0;
assign e = 1'b1;
assign f = 1'b0;
assign f = 1'b1;
assign g = 1'b1;
assign g = 1'b0;
assign (strong1,strong0) h = 1'b0;
assign ( weak1, weak0) h = 1'b1;
assign (... |
#include <bits/stdc++.h> using namespace std; int main() { string a, b, c; int n; cin >> n >> a; sort(a.begin(), a.end()); for (int i = 0; i < a.size(); i += n) b += a[i]; for (int i = 0; i < n; i++) c += b; b = c; sort(b.begin(), b.end()); if (b != a) cout << -1; else ... |
#include <bits/stdc++.h> using namespace std; long long spf[1000005]; vector<long long> primes, prev[1000005], next[1000005]; void sieve() { for (long long i = 2; i < 1000005; ++i) { if (spf[i] == 0) { spf[i] = i; for (long long j = 2 * i; j <= 1000005; j += i) { if (spf[j] =... |
// ==============================================================
// RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2012.3
// Copyright (C) 2012 Xilinx Inc. All rights reserved.
//
// ===========================================================
`timescale 1 ns / 1 ps
(* CO... |
/**
* 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() { long long q; cin >> q; if (q == 1) { cout << 1 n0 n ; return 0; } long long a = -1, b = -1; for (long long d = 2; d * d <= q; d++) { if (q % d) continue; a = d; b = q / d; break; } if (a =... |
/**
* 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 "./Definition.v"
module Divider
(
input[ `size_int - 1 : 0 ]Dividend,
input[ `size_int - 1 : 0 ]Divisor,
output reg[ `size_int - 1 : 0 ]Q, // Quotient
output reg[ `size_int - 1 : 0 ]Remainder // Remainder
);
// counter
integer i;
reg[ `size_int - 1 : 0 ]Quotient; // Quotient
reg[ `size_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> #pragma GCC optimize(3, inline , Ofast ) using namespace std; int p[1010]; bool vis[1010]; void dfs(int pos) { if (vis[pos]) return (void)(printf( %d , pos)); else vis[pos] = 1, dfs(p[pos]); } int main() { int n; scanf( %d , &n); for (int i = 1; ... |
#include <bits/stdc++.h> using namespace std; long long A, B, N; long long L, T, M; bool ok(long long R) { long long mx = A + (R - 1) * B; long long mn = A + (L - 1) * B; long long D = R - L; if (mx > T) return false; return (mn * (D + 1) + B * D * (D + 1) / 2) <= T * M; } int main(void)... |
/*
* 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 = 400; const int MOD = (int)1e9 + 7; int n, x; long long fac[N], c[N][N]; map<int, int> h; vector<int> d; int fix(int x) { for (int i = 2; i * i <= x; i++) { while (x % (i * i) == 0) { x /= i * i; } } return x; }... |
// Flipflop intermediate map level
module \$__FF_NOLSR (input D, C, E, output Q);
parameter _TECHMAP_WIREINIT_Q_ = 1'bx;
wire _TECHMAP_REMOVEINIT_Q_ = 1'b1;
generate
if (_TECHMAP_WIREINIT_Q_ === 1'b1)
FD1P3JX #(.GSR("DISABLED")) _TECHMAP_REPLACE_ (.D(D), .CK(C), .SP(E), .PD(1'b0), .Q(Q));
else
FD1P3IX #(.G... |
//////////////////////////////////////////////////////////////////////
//// ////
//// OR1200's Store Buffer ////
//// ////
//// This file is part of the OpenR... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2016.1
// Copyright (C) 1986-2016 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1ns/1ps
m... |
`timescale 1ns / 1ps
`define SIMULATION
module peripheral_mult_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 uut (.clk(clk) , .rst(rst) , .d_in(d_in) , .cs(cs) , .addr(addr) , .rd(rd) , .wr(wr), ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 24.06.2017 01:23:43
// Design Name:
// Module Name: funciones_cursor
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
// ... |
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int r = 0, b = 0, y = 0, g = 0; int len = s.size(); for (int i = 0; i < len; i++) { if (s[i] == B ) b = i % 4; else if (s[i] == G ) g = i % 4; else if (s[i] == R ) r = i % ... |
/*
* 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... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2003 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc; initial cyc=1;
// verila... |
#include <bits/stdc++.h> using namespace std; const long double EPS = 1e-9, PI = acos(-1.); const int INF = 0x3f3f3f3f, MOD = 1e9 + 7; const int N = 1e5 + 5; int n, x, v; long long sm; int main() { scanf( %d%d , &n, &x); for (int i = 0; i < n; ++i) scanf( %d , &v), sm += v; printf( %s n , sm +... |
/***************************************************************************************************
** fpga_nes/hw/src/wram.v
*
* Copyright (c) 2012, Brian Bennett
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following... |
//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 associate... |
/*******************************************************************************
* 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 ... |
#include <bits/stdc++.h> using namespace std; struct abcd { int to, next; } table[300300 << 1]; int head[300300], tot; int n, m; char ans[300300]; void Add(int x, int y) { table[++tot].to = y; table[tot].next = head[x]; head[x] = tot; } void DFS(int x) { int i, cnt = 0; for (i ... |
// ***************************************************************************
// ***************************************************************************
// 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> bool FLAG = 1; using namespace std; const long long MOD = (long long)1e9 + 7, N = (long long)2e6 + 222; const long long INF = (long long)1e18; long long n, k, p[N], a[N], b[N], b1[N]; string s; void clear() { for (long long i = 1; i <= n; ++i) { p[i] = a[i]; } } ... |
#include <bits/stdc++.h> #pragma GCC optimize( O2 ) using namespace std; void dfs(long long int par, long long int node, vector<pair<long long int, string>> adj[], vector<long long int> &nodes, vector<bool> &visited) { visited[node] = true; nodes.push_back(node); for (auto child ... |
/*
* Milkymist SoC
* Copyright (C) 2007, 2008, 2009 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 distributed 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... |
/*
* 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 n, m; cin >> n >> m; map<int, int> mp; vector<int> ans; int a; for (int i = 0; i < n; i++) { scanf( %d , &a); mp[a] = 1; } n = m; for (int i = 1; i <= n; i++) { if (i > m) break; if (mp[i] == 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 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... |
#include <bits/stdc++.h> using namespace std; #pragma GCC target( avx2 ) #pragma GCC optimization( O3 ) #pragma GCC optimization( unroll-loops ) void solve() { long long n, m, k; cin >> n >> m >> k; long long lb = n / m; long long ub = (n + m - 1) / m; vector<long long> seat; for (long... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: scfifo
// ============================================================
// File Name: fifo_256_139.v
// Megafunction Name(s):
// scfifo
//
// Simulation Library Files(s):
// altera_mf
// ==============================... |
#include <bits/stdc++.h> using namespace std; int main() { pair<int, int> p[100]; int n; cin >> n; for (int i = 0; i < n; i++) { cin >> p[i].first; p[i].second = i + 1; } sort(p, p + n); for (int i = 0; i < n; i++) cout << p[i].second << ; } |
/**
* 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... |
/*
* yosys -- Yosys Open SYnthesis Suite
*
* Copyright (C) 2012 Claire Xenia Wolf <>
*
* 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 maxn = 200500; int mapp[maxn], num[maxn], ans[maxn]; int main() { int n, a, b, k; while (cin >> n >> a >> b >> k) { memset(ans, 0, sizeof(ans)); char c; for (int i = 0; i < n; i++) { cin >> c; mapp[i] = c - 0 ; ... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: sparc_exu_aluadder64.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute... |
#include <bits/stdc++.h> using namespace std; int n, i, j, k, x, y, w, m, Q, used[100500], start; pair<pair<int, int>, int> a[100500]; vector<pair<int, int> > g[100500]; vector<int> f[100500]; long long d[100500]; long long hea[200500]; int new_w[100500], new_d[100500]; int hea2[200500]; int st[1005... |
#include <bits/stdc++.h> using namespace std; string s[51]; int main() { int tot = 1; cin >> s[1]; int len = s[1].size(); for (int i = 2; i <= s[1].size(); i += 1) { s[i] = s[i - 1]; string ss; ss.resize(1); ss[0] = s[i][len - 1]; s[i].insert(0, ss); s[i].erase(... |
/*------------------------------------------------------------------------------
* 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... |
//==================================================================================================
// Filename : musb_div.v
// Created On : 2014-10-27 21:59:02
// Last Modified : 2015-05-24 21:00:17
// Revision : 1.0
// Author : Angel Terrones
// Company : Universidad Simón Bolívar
// ... |
`include "lo_simulate.v"
/*
pck0 - input main 24MHz clock (PLL / 4)
[7:0] adc_d - input data from A/D converter
pwr_lo - output to coil drivers (ssp_clk / 8)
adc_clk - output A/D clock signal
ssp_frame - output SSS frame indicator (goes high while the 8 bits ... |
/*
* 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... |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: bios.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// =======================... |
//-----------------------------------------------------------------------------
// File : hierarchical_wb_slave_0.v
// Creation date : 28.11.2017
// Creation time : 16:51:22
// Description : A wishbone slave containing another wishbone slave, so now you can use a wishbone slave while using a wishbone slave.
... |
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int i, l = s.length(); char max = s[0]; for (i = 1; i < l; i++) { if (s[i] > max) max = s[i]; } for (i = 0; i < l; i++) { if (max == s[i]) cout << max; } } |
#include <bits/stdc++.h> using namespace std; int main() { string s, ans = ; cin >> s; int i = 0, j = s.size() - 1; while (i < j) { if (s[i] == s[j]) { i++; j--; continue; } else { s.insert(s.begin() + j + 1, s[i]); i++; } } cout <<... |
#include <bits/stdc++.h> using namespace std; int n, a[100005], res = 1e9, A, B, x[100005], kq[100005], kq1[100005], dem = 0, e[100005]; void no(int val) { if (a[n] >= 0 || a[n - 1] >= 0 || res <= val) return; res = val; for (int i = 2; i <= n - 1; i++) kq[i] = x[i]; return; ... |
`timescale 1ns / 1ps
/*
-- Module Name: Outport Scheduler
-- Description: Top Level del Planificador de Salida. El modulo se
encarga de administrar el proceso de asignacion de
uso de puertos de salida. En el rse reciben peticiones
desde de los puertos de entrada (lnk controller). Se
ejecuta un proce... |
`define bsg_xor_macro(bits) \
if (harden_p && (width_p==bits)) \
begin: macro \
bsg_rp_tsmc_250_XOR2X1_b``bits xor_gate (.i0(a_i),.i1(b_i),.o); \
end
module bsg_xor #(parameter `BSG_INV_PARAM(width_p)
, parameter harden_p=... |
#include <bits/stdc++.h> using namespace std; int n, m, b; struct chel { int cost; int mas; int coun; }; chel f[103]; chel tem[103]; void mergesort(chel *a, chel *b, int n) { int i, i0, i1, iRight, iEnd, width, j; for (width = 1; width < n; width *= 2) for (i = 0; i < n; i += wid... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2005 by Wilson Snyder.
//
// Example module to create problem.
//
// generate a 64 bit value with bits
// [HighMaskSel_Bot : LowMaskSel_Bot ] = 1
// [HighMaskSel_Top+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... |
module riscv_tb ();
parameter ADDI = 1;
parameter ORI = 2;
parameter XORI = 3;
parameter ANDI = 4;
parameter SLTI = 5;
parameter SLTUI = 6;
parameter SLLI = 7;
parameter SRLI = 8;
parameter SRAI = 9;
parameter LUI = 10;
parameter AUIPC = 11;
parameter ADD = 12;
parame... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); int a, b, c, i, j, cnt = 0; cin >> a >> b >> c; for (i = 0; i <= c; i++) { for (j = c; j >= 0; j--) { if ((j * a + i * b) == c) { cout << Yes << endl; cnt = 1; break;... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; const int N = 110031; long long n, m; vector<vector<long long> > one(int sz) { vector<vector<long long> > ret; ret.resize(sz); for (int i = 0; i < ret.size(); i++) { ret[i].resize(sz); for (int j = 0; j < ret.size... |
/*
* 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... |
//////////////////////////////////////////////////////////////////////
//// ////
//// tiny_spi.v ////
//// ////
//// This file is part of the TINY ... |
// file: bclk_dll_tb.v
//
// (c) Copyright 2008 - 2011 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaim... |
`timescale 1ns/10ps
module mainPLL_0002(
// interface 'refclk'
input wire refclk,
// interface 'reset'
input wire rst,
// interface 'outclk0'
output wire outclk_0,
// interface 'locked'
output wire locked
);
altera_pll #(
.fractional_vco_multiplier("true"),
.reference_clock_frequency("50.0 MHz"),
.... |
#include<iostream> #include<string> using namespace std; int main() { int T; cin >> T; for (int t=0;t<T;t++) { string s; int n, q; cin >> n >> q >> s; int f0 = -1; int f1 = -1; int l0 = -1; int l1 = -1; for (int i=0;i<n;i++) { if(s[i]== 0 ) { l0=i; if( f0... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, x, mx = 0, ans; cin >> n; while (n--) { cin >> x; if (x > mx) mx = x; } ans = mx ^ x; cout << ans << endl; return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, q; cin >> n >> q; vector<int> res(n + 1, 0); vector<vector<int>> adjacenyList(n + 1); for (int i = 1; i < n; i++) { int u, v; cin >> u >> v; ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const int N = 16; const int inf = 1e9 + 7; int f[N][N][N][2][2][2]; struct node { int x; int y; int z; int i1; int j1; int k1; int p1; int fi1, fi2; } pre[N][N][N][2][2][2]; int a[N], b[N], c[N]; char s[N * 5]; inline void U... |
#include <bits/stdc++.h> using namespace std; const int N = 200004, M = 19; vector<int> g[N]; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } int d[N], fa[N][M], n; long long w[N][M], a[N], mod = 1000000007; void bfs() { d[1] = 1; for (int i = 0; i < M; i++) w[1][i] = a[1... |
#include <bits/stdc++.h> using namespace std; int main() { int n, x; cin >> n; x = (n + 1) / 2; string s, even, odd; cin >> s; for (int i = 0; i < n; i++) { if (i % 2 == 0) odd.push_back(s[i]); else even.push_back(s[i]); } if (n <= 2) { cout << s << ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = (int)(1e5 + 123); vector<int> gg[MAXN], gb[MAXN]; bool was[MAXN], been[MAXN]; int cnt = 0; void dfs(int v) { cnt++; was[v] = been[v] = true; for (auto to : gg[v]) { if (was[to]) continue; dfs(to); } } int main() {... |
#include <bits/stdc++.h> using namespace std; int a[200010]; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); sort(a + 1, a + n + 1); int mn = a[n]; for (int i = 1; i <= n / 2; i++) mn = min(mn, a[i + n / 2] - a[i]); printf( %d n , mn); return 0... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11:40:54 03/28/2015
// Design Name:
// Module Name: regfileparam
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// De... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5, M = 35; int n, m, x; int g[M][M], tot, v[1000][2]; int main() { int T; cin >> T; while (T--) { cin >> n >> m; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { scanf( %d , &g[i][j]); ... |
#include <bits/stdc++.h> using namespace std; vector<int> E[65600]; vector<pair<int, int> > V; int main() { int n; scanf( %d , &n); queue<int> Q; int degree[65600 + 10], Xsum[65600 + 10]; for (int i = 0; i < n; i++) { int a, b; scanf( %d %d , &a, &b); degree[i] = a; X... |
#include <bits/stdc++.h> using namespace std; int mod = (int)1e9 + 7; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cout << name << : << arg1 << n ; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma ... |
#include <bits/stdc++.h> using namespace std; int n, a, k; int x[200030], xx[200030]; bool judge(int m) { for (int i = 1; i <= m; i++) xx[i] = x[i]; sort(xx + 1, xx + 1 + m); int ans = 0; xx[0] = 0; for (int i = 1; i <= m; i++) ans += (xx[i] - xx[i - 1]) / (a + 1); ans += (n - xx[m] + 1)... |
#include <bits/stdc++.h> const int N = 1000; bool vis[N + 100]; int v[N + 100]; int top = 0; int n = 0; int main() { scanf( %d , &n); for (int i = 2; i <= n; i++) { if (!vis[i]) { vis[i] = true; for (int j = 0; j < n; j++) { if (!vis[j]) continue; if (i * j ... |
#include <bits/stdc++.h> using namespace std; long long exp(long long a, long long b, long long p) { if (b == 0) return 1; if (b % 2) return a * exp(a, b - 1, p) % p; return exp(a * a % p, b / 2, p); } long long inv[1000009], E[1000009]; int main() { long long a, b, p, x; cin >> a >> b >> ... |
// (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 ... |
#include <bits/stdc++.h> using namespace std; int X1[500010], Y1[500010], X2[500010], Y2[500010]; int main() { int n, i; scanf( %d , &n); for (i = 1; i <= n; i++) scanf( %d %d %d %d , &X1[i], &Y1[i], &X2[i], &Y2[i]); printf( YES n ); for (i = 1; i <= n; i++) { if (X1[i] % 2 == 0) { ... |
#include <bits/stdc++.h> using namespace std; int vis[2005]; int main() { int n, m, k; char c; scanf( %d%d%d , &n, &m, &k); int ans = 0; for (int i = 0; i < n; i++) { getchar(); int temp = 0; for (int j = 0; j < m; j++) { scanf( %c , &c); if (c == . ) { ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 3e5 + 10; const long long INF = 1e18 + 10; struct node { int next, v; } edge[maxn * 2 + 10]; int cnt, head[maxn], vis[maxn], pa[maxn]; long long sum[maxn], cost[maxn], a[maxn], ss[maxn]; queue<int> q; int find(int x) { if (x == pa[... |
#include <bits/stdc++.h> int main() { int n, i; scanf( %d , &n); int array[n]; for (i = 0; i < n; i++) { scanf( %d , &array[i]); } int min = 9999999, max = 0, count; for (i = 0; i < n; i++) { if (array[i] < min) { min = array[i]; } if (array[i] > max) { ... |
`include "config.v"
module seq_channel(
clk,
reset, operate,
out,
reg_clk, reg_addr, reg_data, reg_wr
);
parameter REGBASE = 0;
input clk;
input reset;
input operate;
output out;
input reg_clk;
input [15:0] reg_addr;
inout [31:0] reg_data;
input reg_wr;
reg out;
initial out = 0;
reg [31:0] counter;
initial coun... |
#include <bits/stdc++.h> using namespace std; string str[500005]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) cin >> str[i]; for (int i = n - 2; i >= 0; i--) { if (str[i] > str[i + 1]) { string temp; for (int j = 0; j < str[i].length(); j++) { if (str[... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; } template <typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; } const int oo = 0x3f3f3f3f; const long long OO = 0x3f3f3f3f3f3f3f... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; namespace io { template <class T> void re(complex<T>& x); template <class T1, class T2> void re(pair<T1, T2>& p); template <class T> void re(vector<T>& a); template <class T, size_t SZ> void re(array<T, S... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2015 by Johan Bjork.
// SPDX-License-Identifier: CC0-1.0
parameter N = 4;
interface a_if #(parameter PARAM = 0) ();
logic long_name;
modport source (output long_name);
modpo... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11:02:53 05/24/2016
// Design Name: escritor_lector_rtc
// Module Name: D:/TEC/I 2016/Lab Digitales/Proyecto III/Proyecto Xillinx/Proyecto_3/testbench_escitor_lector_... |
/**
* 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... |
//////////////////////////////////////////////////////////////////////
//// ////
//// OR1200's Freeze logic ////
//// ////
//// This file is part of the OpenR... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b); long long mpower(long long x, long long y, long long c); int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); map<long long, long long> M; vector<long long> aa; set<long long> ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.