text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> const int MAX_LEN = 1010; using namespace std; template <typename U, typename V> string to_string(pair<U, V>); string to_string(const string& e_) { return + e_ + ; } string to_string(char e_) { return + string(1, e_) + ; } string to_string(bool e_) { return e_ ? t... |
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > ans; vector<int> e[100010]; void dfs(int x, int p, int entry) { ans.emplace_back(x, entry); if (x == 1) { for (int it : e[x]) if (it != p) dfs(it, x, ++entry), ans.emplace_back(1, entry); } else { int cur = ent... |
// (C) 2001-2011 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated doc... |
#include <bits/stdc++.h> using namespace std; struct node { int num; string ss; }; unordered_map<string, node> mm; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; while (cin >> n) { mm.clear(); for (int i = 0; i < n; i++) { string s; cin >> s; ... |
#include <stdio.h> #include <sys/time.h> #define N 100000 #define Q 100000 #define A 100000 #define B 2154 /* B = floor(Q^(2/3)) = floor(N^(2/3)) */ #define INF 0x3f3f3f3f int min(int a, int b) { return a < b ? a : b; } unsigned int X; void srand_() { struct timeval tv; gettimeofd... |
`default_nettype none
//All DFF* have INIT, but the hardware is always initialised to the reset
//value regardless. The parameter is ignored.
// DFFN D Flip-Flop with Negative-Edge Clock
module \$_DFF_N_ (input D, C, output Q);
DFFN _TECHMAP_REPLACE_ (.D(D), .Q(Q), .CLK(C));
wire _TECHMAP_REMOVEINIT_Q_ = 1;
endmo... |
//////////////////////////////////////////////////////////////////////
//// ////
//// OR1200's reg2mem aligner ////
//// ////
//// This file is part of the OpenR... |
#include <bits/stdc++.h> using namespace std; const int MX = 1000001; const int MI = 100001; const int MT = 10001; int main() { long long int n, ans = 0; cin >> n; ans = (n * (n + 1)) / 2; n--; for (int i = 0; i < n; ++i) { int x; scanf( %d , &x); ans -= x; } cout... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, a[120], i, j, res; while (scanf( %d %d , &n, &m) == 2) { for (i = 1; i <= n; i++) { scanf( %d , &a[i]); } bool flag = true; int k = 0; while (flag) { for (i = 1; i <= n; i++) { if (a[... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:01:19 03/26/2016
// Design Name:
// Module Name: mem
// Project Name:
// Target Devices:
// Tool versions:
// Description: ƬÉÏ´æ´¢£¬²ÉÓÃXilinx... |
#include <bits/stdc++.h> using namespace std; vector<long long> v[2]; long long get(long long a, long long b) { return (a + b != 0); } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; cin >> t; string s; long long ans, x, y, a, b, c, d; long long minx, ma... |
module rs232_timer(
// outputs high on output "done" after delay
// inputs
clk,
reset_n, // asynchronous
start,
extra_delay,
// outputs
done,
state
);
`include "parameters_global.v"
input clk;
input reset_n;
input start;
input extra_delay;
... |
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; int l[500], r[500], d[500], ans[500]; for (int i = 0; i < q; i++) { cin >> l[i] >> r[i] >> d[i]; int quo; if (d[i] < l[i]) { ans[i] = d[i]; } else { quo = int(r[i] / d[i]); ans... |
#include <bits/stdc++.h> using namespace std; const int MAX_INT = 1000 * 1000 * 1000; int n, m; vector<int> ver; vector<int> hor; int main() { cin >> n >> m; ver.reserve(n + 1); ver.resize(n); for (int i = 0; i < n; ++i) cin >> ver.at(i), ver.at(i) += 1; ver.push_back(MAX_INT + 1); s... |
/* wb_cdc_tb. Part of wb_intercon
*
* ISC License
*
* Copyright (C) 2019 Olof Kindgren <>
*
* 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; int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; long long n; cin >> n; long long arr[2 * n]; for (long long i = 0; i < 2 * n; i++) cin >> arr[i]; long long m = 0; for (long long i = 0; i < 2 * n; i++) { ... |
#include <bits/stdc++.h> using namespace std; struct W { int t, l, r; } w[100010]; int n, m, s, f; int main() { while (cin >> n >> m >> s >> f) { for (int i = (0); i < (m); i++) { cin >> w[i].t >> w[i].l >> w[i].r; } int t = 1, p = 0; int dir = f > s ? 1 : -1; whi... |
// ==================================================================
// >>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<
// ------------------------------------------------------------------
// Copyright (c) 2006-2011 by Lattice Semiconductor Corporation
// ALL RIGHTS RESERVED
// -------... |
//Need at least one LUT per frame base address we want
`ifndef N_LUT
`define N_LUT 100
`endif
`ifndef N_BRAM
`define N_BRAM 8
`endif
`ifndef N_DI
`define N_DI 1
`endif
module top(input clk, stb, [DIN_N-1:0] di, output do);
parameter integer DIN_N = `N_DI;
parameter integer DOUT_N = `N_LUT + `N_BRAM;
wire [DIN_N-... |
#include <bits/stdc++.h> using namespace std; int a[100005], vis[100005], b[100005], h[100005], g[100005]; int main() { int n, m = 0; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; if (a[i] == i) { g[a[i]] = ++m; h[m] = i; } } for (int i = 1; i <= n; i+... |
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); int n, m; long long minb[100010]; long long maxg[100010]; int main() { cin >> n >> m; for (int i = 0; i < n; i++) { scanf( %lld , minb + i); } sort(minb, minb + n); for (int i = 0; i < m; i++) { scanf... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; for (int i = n + 1; i <= m; i++) { int count = 0; for (int j = 2; j < i; j++) { if (i % j == 0) count++; } if (count == 0) { if (m == i) { cout << YES << endl; ... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; void solve() { int n, ans = 0; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; ans = max(ans, a[i] - i - 1); } cout << ans << n ; } int main() { int t; cin >> t; ... |
#include <bits/stdc++.h> using namespace std; vector<string> a; int n, j; string s; map<long long, int> f; long long h(string s) { long long res = 0; for (int i = 0; i < s.length(); i++) res = res * 28 + (s[i] - a ) + 1; return res; } int main() { scanf( %d , &n); for (int i = 1; i ... |
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a); } long long int power(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 = y >> ... |
#include <bits/stdc++.h> using namespace std; int n, t; int s[100013]; int g[17][100013]; int lg[100013]; vector<pair<int, int> > sorted; int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); } int find_l(int gcf, int ind) { int left = 0, right = sorted.size() - 1; while (left < right) { ... |
#include <bits/stdc++.h> using namespace std; int cnt = 0; vector<int> ans; vector<vector<int> > adj; void dfs(int u, int col) { if (ans[u] != -1) return; ans[u] = col; for (int i = 0; i < adj[u].size(); ++i) dfs(adj[u][i], col); } char conv(int first) { if (first == 0) return b ; if ... |
//syscontrol handles the startup of the FGPA,
//after fpga config, it automatically does a global system reset and asserts boot.
//the boot signal puts gary in a special mode so that the bootrom
//is mapped into the system memory map. The firmware in the bootrom
//then loads the kickstart via the diskcontroller into th... |
#include <bits/stdc++.h> using namespace std; template <class T> bool maximize(T &x, const T &y) { if (x < y) x = y; else return false; return true; } const int N = 5e5 + 10; int n, q, md; int dx[N]; int d[N][21]; int query(int x, int y) { if (d[x][20] < y) return -1; i... |
//
// Generated by Bluespec Compiler, version 2021.07 (build 4cac6eb)
//
//
// Ports:
// Name I/O size props
// result_valid O 1
// result_value O 128 reg
// CLK I 1 clock
// RST_N I 1 reset
//... |
//
// Copyright (c) 1999 Steven Wilson ()
//
// 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)
// ... |
module alt_vipvfr131_common_avalon_mm_slave
#(parameter
AV_ADDRESS_WIDTH = 5,
AV_DATA_WIDTH = 16,
NO_OUTPUTS = 1,
NO_INTERRUPTS = 1, // NO_INTERRUPTS < AV_DATA_WIDTH!!!
NO_REGISTERS = 4,
ALLOW_INTERNAL_WRITE = 0) // writing to registers internally allowed or not
(
input wire ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:19:44 10/07/2014
// Design Name:
// Module Name: pwm
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Rev... |
/*
* integer4ge - a verilog test for integer greater-or-equal conditional >=
*
* Copyright (C) 2000 Steve Wilson
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (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 law... |
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2014.4 (win64) Build Tue Nov 18 18:29:27 MST 2014
// Date : Tue Jun 30 17:04:31 2015
// Host : Vangelis-PC running 64-bit major release (... |
#include <bits/stdc++.h> int mod, n, a, b, good; std::set<std::pair<int, int> > set; std::pair<int, int> make_pair(int i, int j) { return {std::min(i, j), std::max(i, j)}; } int main() { scanf( %d%d , &mod, &n); for (int i = 0; i < n; i++) { scanf( %d%d , &a, &b); set.insert(make_pair(... |
#include <bits/stdc++.h> using namespace std; const int MN = 1e4 + 20; vector<int> adj[MN], topo; vector<pair<int, int>> edge; int scc, st, s[MN], h[MN], t[MN]; bool os[MN]; stack<int> ms; int n, m; void add(int u, int v) { adj[u + m].push_back(v); adj[v + m].push_back(u); adj[u].push_back... |
//
// 2 read-port, 1 write-port ram
//
// reads are synchronous
//
//
module bsg_mem_2r1w_sync #(parameter `BSG_INV_PARAM(width_p)
, parameter `BSG_INV_PARAM(els_p)
, parameter read_write_same_addr_p=0
, parameter addr_width_lp=`BSG_SAFE_... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; const int N = 2e5 + 10; const int MX = 1e9; int n, t; int ar[N], mn[N]; unordered_map<int, int> bit; void upd(int x, int val) { x++; while (x <= t) { bit[x] += val; x += (x & (-x)); ... |
//Legal Notice: (C)2006 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... |
#include <bits/stdc++.h> using namespace std; long long i, j, k, l, m, n, t, a[211111], b[211111], c[111111], d, s; string p[111111], q[111111]; int main() { cin >> n; for (i = 1; i <= n; i++) scanf( %I64d , &a[i]); for (i = 1; i <= n; i++) scanf( %I64d , &b[i]); i = 1; j = 1; while (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... |
#include <bits/stdc++.h> using namespace std; int n; void draw(int k) { for (int i = 0; i < n - k; i++) { cout << ; } for (int i = 0; i < k; i++) { cout << i << ; } for (int i = k; ~i; i--) { cout << i << (i ? : n ); } } int main() { cin >> n; for... |
#include <bits/stdc++.h> using namespace std; int n, x; int a[105]; long double dp[2][105][10005]; const long double threshold = 1e-12; int main() { scanf( %d%d , &n, &x); long double s = 0.0; for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); s += a[i]; } dp[0][0][0] = 1.0; ... |
// (C) 1992-2014 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 simulati... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21:16:06 08/03/2009
// Design Name:
// Module Name: ctrl
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Re... |
#include <bits/stdc++.h> using namespace std; struct SegmentTreeLazy { typedef long long T; const T inf = (T)1e18; const T not_found = -2; SegmentTreeLazy(vector<T> &v) { n = static_cast<int>(v.size()); int pow2 = 1; while (pow2 < n) pow2 <<= 1; mx.resize(2 * pow2, -inf); ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 3e5; int l = 0; int r = 0; int res = 0; int f[maxn + 11][55]; int a[maxn + 11]; int cnt[maxn + 11]; void add(int x) { if (!cnt[a[x]]) res++; cnt[a[x]]++; } void del(int x) { cnt[a[x]]--; if (!cnt[a[x]]) res--; } int... |
// soc_design_niosII_core.v
// This file was auto-generated from altera_nios2_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 16.0 211
`timescale 1 ps / 1 ps
module soc_design_niosII_core (
input wire clk, // ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 300000 + 10; long long num[maxn], dp[maxn][15]; void Solve() { int n, m, k; scanf( %d%d%d , &n, &m, &k); for (int i = 1; i <= n; i++) scanf( %lld , &num[i]); long long ans = 0; for (int i = 1; i <= n; i++) { for (int j = 1;... |
/*
* 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... |
// Check the various variable array selects (large to small).
module top;
reg passed;
wire [1:0] a [4:1];
wire [0:0] s0 = 0;
wire [1:0] s1 = 0;
wire [2:0] s2 = 0;
reg [1:0] ar [4:1];
wire [1:0] c [0:-3];
wire [0:0] s3 = 0;
wire [1:0] s4 = 0;
reg [1:0] cr [0:-3];
wire [1:0] res_a0 = a[s0];
wir... |
module auto_module
( input my_clk,
input my_rst_n,
output manually_listed,
/*AUTOINOUTMODPORT("automodport_if" "pure_mp")*/
//ex: input in_pure;
//ex: output out_pure;
/*AUTOINOUTMODPORT("automodport_if" "req_mon_mp")*/
//ex: input req_credit, // To auto_i of auto_intf.sv
//ex: input [63:0] r... |
/**
* 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; template <typename T> ostream& operator<<(ostream& out, const vector<T>& vec) { out << [ ; for (int x : vec) out << x << , ; out << ] ; return out; } int main() { int M; long long N, A, D; cin >> N >> M >> A >> D; vector<long lo... |
#include <bits/stdc++.h> using namespace std; int n, k, m; int arr[50]; int sub[50]; int result = 0; int task_tot_time = 0; void take(int score, int t) { if (0 >= t) return; int tt = t; int ss = score; for (decltype(0) i = 0; i < k; i++) { int su = sub[i]; while (su > 0) { ... |
#include <bits/stdc++.h> using namespace std; int main() { int i, j, n, t, x; string s = ; cin >> t; for (i = 0; i < t; i++) { s += o ; } int ara[t + 5]; ara[0] = 1; ara[1] = 1; s[0] = O ; s[1] = O ; for (i = 2; i <= t; i++) { ara[i] = ara[i - 1] + ara[i ... |
#include <bits/stdc++.h> using namespace std; const int N = 100; int n, k[N]; double p[N], p_log[N], p_log_1[N]; priority_queue<pair<double, int>> s; inline double P(int i, int k) { double x = pow(p[i], k); if (x > 1e-6) return log(1 - x); x = -x; return x - x * x / 2 + x * x * x / 3; } ... |
#include <bits/stdc++.h> using namespace std; int a, b, c, d[100005]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> a >> b >> c; a = a % b; d[a]++; int t; for (int i = 1; i <= 100005; ++i) { t = a * 10 / b; if (t == c) { cout << i; ... |
#include <bits/stdc++.h> using namespace std; set<int> st[2]; map<int, int> mp; int ar[110]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { cin >> ar[i]; mp[ar[i]]++; } int idx = 0; map<int, int>::iterator it1; for (it1 = mp.begin(); it1 != mp.end(); it1++)... |
`include "delay.v"
`include "arbiter.v"
module uartmm(input clk,
input rst,
input RX,
output TX,
output [31:0] data_b,
output reg strobe_b,
input [31:0] addr_b,
input [31:0] dat... |
/**
* 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> const int inf = INT_MAX; const int MAX = 1e3 + 8; const long long MOD = 1e9 + 7; const int TOT_PRIMES = 1e6 + 9; const int MAX_A = 71; const int LN = 20; using namespace std; int main() { int n, k; cin >> n >> k; int a[32]; memset(a, 0, sizeof(a)); for (int i... |
//+FHDR------------------------------------------------------------------------
//Copyright (c) 2013 Latin Group American Integhrated Circuit, Inc. All rights reserved
//GLADIC Open Source RTL
//-----------------------------------------------------------------------------
//FILE NAME :
//DEPARTMENT : IC Design / Veri... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
`timescale 1ns/1ps
module ntsc_gen(clk,v_sync,v_data);
parameter DATA_BITS = 4;
input clk;
output reg [DATA_BITS-1:0] v_data;
output v_sync;
wire [DATA_BITS-1:0] data;
wire [DATA_BITS-1:0] sync;
//50 Mhz clock
reg [9:0] xpos = 0;
reg [8:0] ypos = 0;
reg [3:0] counter = 0;
reg [7:0] colorburst = 8'b01100100;
always @(p... |
#include <bits/stdc++.h> const int maxn = 100000 + 5; using namespace std; int main() { int n, a[maxn]; cin >> n; bool flag = false; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); for (int i = 2; i < n; i++) { int x = a[i], y = a[i - 1]; int z = a[i - 2]; if ((y... |
`default_nettype none
module gci_std_display_data_read #(
parameter P_AREA_H = 640,
parameter P_AREA_Y = 480,
parameter P_READ_FIFO_DEPTH = 64,
parameter P_READ_FIFO_DEPTH_N = 6,
parameter P_MEM_ADDR_N = 19
)(
//System
input wire iGCI_CLOCK,
input wire iDISP_CLOCK,
input wire inRESET,
input wir... |
`timescale 1 ns / 1 ps
module system (
input clk,
input resetn,
output trap,
output reg [7:0] out_byte,
output reg out_byte_en
);
// 0x2000 32bit words = 0x8000 Byte = 32kByte memory
parameter MEMW_SIZE = 16'h8000;
integer tb_idx;
wire m... |
/**
* 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 cap[1000000], flow[1000000]; int to[1000000], _prev[1000000], last[10000], used[10000], level[10000]; struct MaxFlow { int V, E; MaxFlow(int n) { int i; V = n; E = 0; for ((i) = 0; (i) < (int)(V); (i)++) last[i] = -1; } vo... |
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); char input[n + 5][n + 5]; for (int i = 0; i < n; i++) scanf( %s , input[i]); int row[n], col[n], count_row = 0, count_col = 0; for (int i = 0; i < n; i++) row[i] = -1; for (int j = 0; j < n; j++) col[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... |
//IEEE Floating Point Multiplier (Single Precision)
//Copyright (C) Jonathan P Dawson 2013
//2013-12-12
module multiplier(
input_a,
input_b,
input_a_stb,
input_b_stb,
output_z_ack,
clk,
rst,
output_z,
output_z_stb,
input_a_ack,
inpu... |
/*
* 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; const long long INF = 1e6 + 7; struct Data { long long min, max, resl, resr; }; struct TNode { long long L, R; TNode *left, *right; Data d; long long val; }; TNode *new_node(long long L, long long R) { return new TNode({L, R, nullptr, n... |
`timescale 1ns / 1ps
`define SIMULATION
module div_16_TB;
reg clk;
reg rst;
reg reset;
reg start;
reg init_in;
reg [15:0]A;
reg [15:0]B;
wire [15:0] Result;
wire done;
div_16 uut (.clk(clk) , .rst(rst) , .init_in(start) , .A(A) , .B(B) , .Result(Result) , .done(done));
para... |
#include <bits/stdc++.h> using namespace std; long long solve(int n) { int x = n; long long cnt = 0, ans = 0; while (x) { x = x / 10; cnt++; } ans = n * cnt + cnt - 1; int k = 1; for (int i = 0; i < cnt - 1; i++) { k = k * 10; ans = ans - k; } return ans; ... |
#include <bits/stdc++.h> using namespace std; int read() { int x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = x * 10 + ch - 48, ch = getchar(); } return x * f; } bool vi... |
#include <bits/stdc++.h> using namespace std; inline void smin(int &a, const int &b) { if (b < a) a = b; } inline void smax(int &a, const int &b) { if (b > a) a = b; } int first[4], second[4], f[4], ans; vector<int> dst, vx, vy; pair<int, int> p[4], mp[4]; inline void solve(int X, int Y, int 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 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... |
//Legal Notice: (C)2010 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; int V[100]; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); int T; cin >> T; while (T--) { int K; cin >> K; const int R = 2 * K + 1; N = 2 * R; int p0 = -1; for (int i = 0; i < N; i++) { ... |
//-------------------------------------------------------------------
//
// COPYRIGHT (C) 2011, VIPcore Group, Fudan University
//
// THIS FILE MAY NOT BE MODIFIED OR REDISTRIBUTED WI... |
/**
* 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
module ball(
input [9:0] paddle_x,
//input [9:0] paddle_y,
input reset,
input start,
input clk,
input clk_50mh,
output [9:0] x_out,
output [9:0] y_out,
output erase_enable,
output [5:0] e_pos,
output reg [2:0] play_sound1,
//output reg play_sound2,
output reg [1:0] ac... |
/*******************************************************************************
* 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 ... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7, lg = 20, N = 1e5 + 5; int ans[N]; bool vis[N]; vector<pair<int, int> > g[N]; struct node { node *ch[11]; node *sp[lg]; int val, lvl, last; node() { memset(ch, 0, sizeof ch); memset(sp, 0, sizeof sp); val... |
#include <bits/stdc++.h> using namespace std; inline int Get() { int x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while ( 0 <= ch && ch <= 9 ) { x = (x << 1) + (x << 3) + ch - 0 ; ch = getchar(); } r... |
/*
* 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... |
//////////////////////////////////////////////////////////////////////
//// ////
//// OR1200's Store Buffer FIFO ////
//// ////
//// This file is part of the OpenR... |
#include <bits/stdc++.h> using namespace std; const int N = 100005; const int MOD = 998244353; int n; char s[N]; int solve() { scanf( %d , &n); scanf( %s , s); bool ok = true; for (int i = 0; i < n;) { int j = i; while (j < n && s[j] == s[i]) ++j; if (s[i] == 0 && i == 0)... |
// file: in_dcm.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 is... |
// --------------------------------------------------------------------
// ng_INT Central register Module
// --------------------------------------------------------------------
`include "ControlPulses.h"
// --------------------------------------------------------------------
module ng_INT(
input CPO... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; set<pair<int, int> > h; vector<int> d(n), s(n); for (int i = 0; i < n; i++) { cin >> d[i] >> s[i]; if (d[i]) { h.insert({d[i], i}); } } vector<pair<int, int> > ans; while (!h.empty()... |
#include <bits/stdc++.h> using namespace std; void input(vector<long long>& v, long n) { for (long long i = 0; i < n; i++) { long long in; cin >> in; v.push_back(in); } } void output(vector<long long> v) { for (long long i = 0; i < v.size(); i++) cout << v[i] << ; } long lon... |
#include <bits/stdc++.h> using namespace std; int t, n, p[100002]; bool id[100002]; int main() { scanf( %d , &t); while (t--) { scanf( %d , &n); for (int i = 1; i <= n; i++) { int a; scanf( %d , &a); p[a] = i; id[i] = true; } id[n + 1] = 0; b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.