text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; void solve() { int n, b, d; cin >> n >> b >> d; int res = 0; int currMass = 0; for (int i = 0; i < n; i++) { int got; cin >> got; if (got > b) continue; currMass += got; ... |
/*
* 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; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); struct custom_hash { static uint64_t splitmix64(uint64_t x) { x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; ... |
// ******************************************************************************* //
// ** General Information ** //
// ******************************************************************************* //
// ** Module : MAC1.v ... |
#include <bits/stdc++.h> using namespace std; int a[101], b[101], g[101][101]; int main() { int i, j, n, k; scanf( %d , &n); for (i = 1; i <= n; i++) scanf( %d , &a[i]); for (i = 1; i <= n; i++) scanf( %d , &b[i]); memset(g, 0, sizeof(g)); for (i = 1; i <= n; i++) { if (i + b[i] <= n... |
#include <bits/stdc++.h> using namespace std; const long long N = 1e6 + 3; long long n, x, a, cnt, ans, sum; string g; deque<long long> v; void DNM() { cin >> n; for (long long i = 0; i < n; i++) { cin >> a; v.push_back(a); if (a > 0) cnt = i; } for (long long i = 0; i <= c... |
/* amiga_clk.v */
/* 2012, */
module amiga_clk (
input wire rst, // asynhronous reset input
input wire clk_in, // input clock ( 27.000000MHz)
output wire clk_114, // SDRAM ctrl clock (114.750000MHz)
output wire clk_sdram, // SDRAM output clock... |
module helloworld_top(
// 50MHz clock input
input clk,
// Input from reset button (active low)
input rst_n,
// cclk input from AVR, high when AVR is ready
input cclk,
// Outputs to the 8 onboard LEDs
output[7:0]led,
// AVR SPI connections
output spi_miso,
input spi_ss,
in... |
module note_pitch2dds_3st_gen(clk, note, pitch, adder);
input wire clk;
input wire [6:0] note;
input wire [13:0] pitch;
output reg [31:0] adder;
reg [32:0] adder_sum;
reg [7:0] adder_mul;
reg [3:0] state;
reg [6:0] note_local;
reg [13:0] pitch_local;
initial begin
note_local <= 7'd0;
pitch_local <= 14'd08192; //... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of vgch_subb
//
// Generated
// by: wig
// on: Fri Jul 7 06:44:20 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../../bugver.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
// $Auth... |
#include <bits/stdc++.h> using namespace std; int ans, a, b, n, x; int main() { scanf( %d , &n); while (n--) { scanf( %d , &x); if (n == 0) a = x; b = max(b, x); } printf( %d n , a ^ b); return 0; } |
module coreir_reg_arst #(
parameter width = 1,
parameter arst_posedge = 1,
parameter clk_posedge = 1,
parameter init = 1
) (
input clk,
input arst,
input [width-1:0] in,
output [width-1:0] out
);
reg [width-1:0] outReg;
wire real_rst;
assign real_rst = arst_posedge ? arst : ~arst;
... |
#include <bits/stdc++.h> using namespace std; int const maxn = int(2 * 1e5 + 5); int dp1[maxn], dp2[maxn], dp3[maxn], n, k, t; string second; char chuyen(char c) { if (c == R ) return G ; if (c == G ) return B ; if (c == B ) return R ; } int main() { ios_base::sync_with_stdio(false);... |
#include <bits/stdc++.h> using namespace std; char s[100100], sir[100100]; int viz[100100], mi, ma, t, n, freq[100100], fre[100100]; int prim(int x) { for (int i = 2; i <= x; ++i) { if (i * i > x) return 1; if (x % i == 0) return 0; } return 1; } int main() { cin >> (s + 1); ... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const int MX = 2e5 + 5; const long long INF = 1e18; const long double PI = 4 * atan((long double)1); template <class T> bool ckmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; } template <class T> bool ckmax(T& a, const T... |
/* -------------------------------------------------------------------------------
* (C)2012 Korotkyi Ievgen
* National Technical University of Ukraine "Kiev Polytechnic Institute"
*--------------------------------------------------------------------------------
*/
module LAG_router (i_flit_in, i_flit_out,
i_c... |
module inout_port(GO, clk, reset, iDATA, oReady, oDATA, SCL, SDA, ACK, ctr);
input GO; // output enable
input clk;
input reset;
input [23:0] iDATA;
output oReady;
output oDATA;
output SCL;
inout SDA;
output ACK;
output [5:0] ctr;
reg a; // output data
wire a_z;
reg b; // input data
wire next_b;
wire ACK;
reg CLK_Disab... |
`timescale 1 ns / 1 ps
module address_remap_v1_0 #
(
// Users to add parameters here
// User parameters ends
// Do not modify the parameters beyond this line
// Parameters of Axi Slave Bus Interface S_AXI_in
parameter integer C_S_AXI_in_ID_WIDTH = 1,
parameter integer C_S_AXI_in_DATA_WIDTH = 32,
pa... |
/// date :2016/3/4
/// engineer :ZhaiShaoMin
/// module name :memory_state_data_ram
/// module function : here is placed the ram of state and data
/// because of design division
/// note: state[3:0] is directory
/// state[5:4] is home directory state .00 :R(dir),01 :W(id),10 TR(dir),11 TW(id).... |
#include <bits/stdc++.h> using namespace std; int main() { long long int h, l; scanf( %lld %lld , &h, &l); printf( %.9f n , (l * l - h * h + 0.0) / (2 * h)); return 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; const int modu = 1e9 + 7; long long int mod(long long int n) { return (n % modu); } bool cmp(long long int a, long long int b) { return a > b; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long int N, a, b, c, d, x ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; ; int beauty[n]; for (int asdf = 0; asdf < n; asdf++) { cin >> beauty[asdf]; }; map<int, long long int> occ; long long int most = 0; for (int... |
#include <bits/stdc++.h> using namespace std; long long po(long long x, long long y) { if (y == 0) return 1; else return x * po(x, y - 1); } vector<long long> a[7], b[7]; void solve(long long l, long long r, long long d) { if (l == r) return; long long m = (l + r) >> 1; for (lo... |
#include <bits/stdc++.h> using namespace std; int main() { long long t, n, max_gcd = 1; cin >> t; while (t--) { cin >> n; cout << n / 2 << endl; } return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { char str1[50], str2[50]; int n, c, k, cnt, flag; cin >> n; while (n--) { flag = cnt = 0; cin >> str1; k = strlen(str1); str1[k] = : ; str1[k + 1] = 0 ; for (int i = 0; i <= k; ++i) { if (str1[i]... |
#include <bits/stdc++.h> using namespace std; int dp[1 << 25]; int tick[25][25], value[25][25], cost[25][25]; int n, m; string s[25]; int main() { cin >> n >> m; for (int i = 0; i < n; i++) cin >> s[i]; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) cin >> value[i][j]; for (in... |
#include <bits/stdc++.h> using namespace std; int a[1000][1000]; int main() { int n, m, x, y; cin >> n >> m; for (int i = 0; i < m; i++) { cin >> x >> y; x--, y--; for (int k = -2; k < 1; k++) for (int l = -2; l < 1; l++) if (x + k >= 0 && x + k < n && y + l >= 0 &&... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int N = 1e3 + 10; char s[N], x[N], y[N]; int n, d; namespace Trie { const int M = N * 60; int ch[M][10], tot = 1, rt = 1, fail[M]; bool ed[M]; inline void insert(int l, int r) { int now = rt; for (int i = l; i <= r;... |
#include <bits/stdc++.h> using namespace std; template <class T> using v2d = vector<vector<T> >; template <class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; } template <class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; } mt19937 rng(chrono::system_clock:... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, k; cin >> n >> k; int cnt = 1; if (k & 1) puts( 1 ); else { do { k /= 2; cnt++; } while (k % 2 != 1); cout << cnt; } return 0; } |
#include <bits/stdc++.h> const long long mod = 998244353; const int kN = 5e3 + 10; int n, a[kN], lim[kN]; long long f[kN], fac[kN], invfac[kN]; inline int read() { int f = 1, w = 0; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == - ) f = -1; for (; isdigit(ch); ch = ... |
(** * Gen: Generalizing Induction Hypotheses *)
(* $Date: 2011-06-07 16:49:17 -0400 (Tue, 07 Jun 2011) $ *)
Require Export Poly.
(** In the previous chapter, we saw a proof that the [double] function
is injective. The way we _start_ this proof is a little bit
delicate: if we begin it with
[[
intros n.... |
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2018, Darryl Ring.
//
// 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... |
#include <bits/stdc++.h> using namespace std; const int N = 20, Mod = 1e9 + 7; int pl, pr, vl, vr, k; long double p, q; vector<int> v; void count(int t) { int L, R; L = min(v[t], pr) - max(v[t - 1] + 1, pl); R = min(v[t + k] - 1, vr) - max(v[t + k - 1], vl); p += max(L + 1, 0) * 1ll * max(R ... |
#include <bits/stdc++.h> using namespace std; string s; int n; int main() { cin >> n; cin >> s; for (int i = 0; i < n; i++) { if (i + 2 < n && s[i] == o && s[i + 1] == g && s[i + 2] == o ) { while (i + 2 < n && s[i + 1] == g && s[i + 2] == o ) i += 2; cout << *** ; ... |
#include <bits/stdc++.h> using namespace std; struct point { int x, y; }; struct ConvexHull { vector<point> hull; int m; ConvexHull() : m(0) { hull.clear(); } bool ccw(point x, point y, point z) { return ((y.x - x.x) * (z.y - x.y) > (y.y - x.y) * (z.x - x.x)); } void MakeHull(i... |
#include <bits/stdc++.h> using namespace std; int n; int x[1000005], y[1000005]; int s[1000005], _sum[1000006], _sumx[1000006], _sumy[1000006], *sum = _sum + 1, *sumx = _sumx + 1, *sumy = _sumy + 1; long long _tot[1000006], *tot = _tot + 1; const int MOD = 1e9 + 7; inline int area(int x, int y, int ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int arr[3][3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) cin >> arr[i][j]; } bool chk[3][3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) chk[i][j] = 1... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; vector<pair<string, int>> v; priority_queue<int, vector<int>, greater<int>> pq; for (int i = 0; i < n; ++i) { string s; cin >> s; ... |
//
// 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)
// ... |
/*
* 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 INF = 0x3f3f3f3f; const double EPS = 1e-6; const int MOD = 1e9 + 7; const int MAXN = 110; const double PI = acos(-1.0); int ipt[MAXN][MAXN]; int main() { int n, m, k; while (~scanf( %d%d%d , &n, &m, &k)) { int ans = INF, all = 1 << m;... |
#include <bits/stdc++.h> using namespace std; int n, t; int main() { cin >> n >> t; long long z = pow(10, n - 2); if (n == 1 and t == 10) return cout << -1 << endl, 0; if (n == 1) return cout << t << endl, 0; if (t == 2 or t == 4 or t == 5 or t == 8 or t == 10) cout << 40; else if (t... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 12:25:53 06/10/2015
// Design Name:
// Module Name: ControlUnit
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
/... |
#include <bits/stdc++.h> using namespace std; vector<int> solve() { const int N = 3e6; vector<bool> isPrime(N, true); isPrime[0] = isPrime[1] = false; for (int i = 0; i * i < N; i++) { if (isPrime[i]) { for (int j = i * 2; j < N; j += i) { isPrime[j] = false; } ... |
/**
* 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 (c) 2006 Rice University //
// All Rights Reserved //
// This code is covered by the Rice-WARP license //
// See http://warp.rice.edu/license/ for details //
//////////////////////////////////////////////////////////
module radio_bridge
... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017
// Date : Fri Mar 31 18:24:55 2017
// Host : LAPTOP-IQ9G3D1I running 64-bit major releas... |
#include <bits/stdc++.h> using namespace std; int main() { string s[] = { zero , one , two , three , four , five , six , seven , eight , nine , ten , eleven , twelve , thirteen , fourteen , fifteen , sixt... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11:13:27 05/30/2013
// Design Name:
// Module Name: sqncdetct
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
... |
// megafunction wizard: %ROM: 1-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: DynamicDelay_Start.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// =====... |
/**
* 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 conmutacion
(
input [3:0] centenas,
input [3:0] decenas,
input [3:0] unidades,
input C,
input D,
input U,
input CLKOUTseg,
output reg [1:0] mostrar,
output reg [3:0] digito
);
reg logic0;
reg [1:0] titileo;
initial
begin
titileo = 0;
end
always@(posedge CLKOUTseg or C or D or U)
b... |
#include <bits/stdc++.h> int main() { int n; scanf( %d , &n); int s = 0; s = n * (n + 1) / 2; if (s % 2 == 0) { printf( 0 ); } else { printf( 1 ); } return 0; } |
#include <bits/stdc++.h> int main() { int n, m; char ch[51]; scanf( %s , &ch); n = strlen(ch); if (n == 1) printf( %c , ch[0]); else { if (n % 2 == 0) m = (n / 2) - 1; else m = (n / 2); printf( %c , ch[m]); int j = 1; for (int i = 1; i <= n /... |
#include <bits/stdc++.h> using namespace std; int main() { float n; cin >> n; cout << ceil(n / 5); return 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... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 16; int from[MAXN], to[MAXN], p[MAXN], q[MAXN]; bool w[MAXN][MAXN]; long long dp[1 << MAXN]; int main() { int n, m, a, b; long long y; cin >> n >> y >> m; fill(from, from + n, 0); fill(to, to + n, 0); fill(w[0], w[m], fal... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2018 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc; initial cyc=1;
Test test (/*AUTOINST*/
// Inputs
... |
// (C) 2001-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 doc... |
#include <bits/stdc++.h> using namespace std; const int N = 100005, INF = 0X3F3F3F3F; int n, tot; char s[N]; vector<int> ans; set<int> s1, s2; int main() { scanf( %s , s + 1), n = strlen(s + 1); for (int i = (1); i <= (n); ++i) { if (s[i] == L ) s1.insert(i); else s2.i... |
/*
Copyright (C) {2014} {Ganesh Ajjanagadde} <>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed i... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of inst_vb_e
//
// Generated
// by: wig
// on: Sat Mar 3 11:02:57 2007
// cmd: /cygdrive/c/Documents and Settings/wig/My Documents/work/MIX/mix_0.pl -nodelta ../../udc.xls
//
// !!! Do not edit this f... |
#include <bits/stdc++.h> using namespace std; vector<long long> adj[100005]; long long a[100005]; long long col; bool ok; bool dfs(long long v, long long par) { ok &= (col == a[v]); for (auto i : adj[v]) { if (i != par) dfs(i, v); } } bool fn(long long v) { bool res = 1; for (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 <cassert> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <iostream> #include <set> #include <map> #include <vector> #include <string> #include <cmath> #include <queue> #include <stack> #include <unordered_set> #include <unordered_map> #... |
module sgpr_simxlsu_wr_port_mux
(/*AUTOARG*/
// Outputs
muxed_port_wr_en, muxed_port_wr_addr, muxed_port_wr_data,
muxed_port_wr_mask,
// Inputs
//**CHANGE [PSP]
//**add ports 9 for SALU integration
wr_port_select, port0_wr_en, port0_wr_addr, port0_wr_data,
port0_wr_mask, port1_wr_en, port1_w... |
#include <bits/stdc++.h> using namespace std; long long t[500005], mid; long long l[500005], r[500005], h[500005]; struct st { long long h, cnt; }; stack<st> q; int main() { cin.sync_with_stdio(0); int n; cin >> n; for (int i = 1; i <= n; i++) cin >> t[i]; q.push({-1, 1}); for ... |
/*main function
1)receiving packet from inputctrl module,and forwarding packets to classification module and offset module
*/
module INGRESS_CTRL(
input clk,
input reset,
input in_inputctrl_pkt_wr,// the packet write request of input_ctrl moudle to inputctrl module
input [133:0] in_inputctrl_pkt,// the packet of input... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7, siz = 1e6 + 5; long long t, n, m, k, a[siz], dp[5002][5002], dp2[5002]; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> t; while (t--) { cin >> n; string s; cin >> s; s = 0 + ... |
#include <bits/stdc++.h> using namespace std; double e[1010][510]; double c[510], b[510]; int main() { int n, m, in, im; scanf( %d%d%d%d , &n, &m, &in, &im); if (m == 1) { e[n][1] = 0.0; for (int i = n - 1; i >= in; --i) { e[i][1] = 2 + e[i + 1][1]; } printf( %.9lf n ... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; vector<long long> dp; dp.push_back(0); dp.push_back(1); while (dp.back() <= n - 1) { dp.push_back(dp[dp.size() - 1] + dp[dp.size() - 2] + 1); } cout << dp.size() - 2 << endl; } |
// (C) 2001-2013 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated doc... |
/*
*******************************************************************************
* File Name : ada_bram.v
* Project : ADA processor
* Version : 0.1
* Date : Sept 1st, 2014
* Author : Angel Terrones <>
*
* Disclaimer : Copyright (c) 2014 Angel Terrones
* ... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: scfifo
// ============================================================
// File Name: psi2c_fifo.v
// Megafunction Name(s):
// scfifo
//
// Simulation Library Files(s):
// altera_mf
// ============================================... |
// ================================================================================
// Legal Notice: Copyright (C) 1991-2008 Altera Corporation
// Any megafunction design, and related net list (encrypted or decrypted),
// support information, device programming or simulation file, and any other
// associated documentat... |
/******************************************************************************
* License Agreement *
* *
* Copyright (c) 1991-2013 Altera Corporation, San Jose, California, USA. *
... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; const long long inf = 0x3f3f3f3f3f3f3f3f; int n, k, b, c; int a[N], A[N], cost[N]; long long ans = inf; void solve(int x) { for (int i = 1; i <= n; ++i) { A[i] = a[i]; cost[i] = 0; while (A[i] % 5 != x) ++A[i], cos... |
#include <bits/stdc++.h> using namespace std; const int inf = 1e9; const long long INF = 1e18; const double eps = 1e-10; mt19937 mrand(chrono::high_resolution_clock::now().time_since_epoch().count()); template <class T> inline void upmin(T &x, T y) { x = x > y ? y : x; } template <class T> inlin... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; int n, k; int pr[N], sz[N]; int root(int x) { return pr[x] = (pr[x] == x ? x : root(pr[x])); } void merge(int x, int y) { x = root(x); y = root(y); if (x == y) return; if (rand() & 1) { pr[x] = y; sz[y] += sz[x... |
// $Header: /devl/xcs/repo/env/Databases/CAEInterfaces/verunilibs/data/spartan4/IDDR2.v,v 1.1 2004/06/21 21:45:36 wloo Exp $
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2004 Xilinx, Inc.
// All Right Reserved.
////////////////////////////////////////////////////... |
/**
* 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... |
`define INPUTS_P 4
/***************** TEST RATIONALE **********************
1. STATE SPACE
The UUT is tested with every possible reqs_i. Each reqs_i
is maintained for 2*INPUTS_P cycles and the grant_count,
no. of times a given input line is granted, of each line
is checked to verify the fairness of the arbi... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long ar1, long long ar2) { return ar2 == 0 ? ar1 : gcd(ar2, ar1 % ar2); } long long add(long long ar1, long long ar2, long long m) { if (ar1 >= m) ar1 %= m; if (ar2 >= m) ar2 %= m; if (ar1 < 0) ar1 += m; if (ar2 < 0) ar2 += 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 law... |
// test_simulation_sop_basic_10_test.v
module f1_test(input [1:0] in, input select, output reg out);
always @( in or select)
case (select)
0: out = in[0];
1: out = in[1];
endcase
endmodule
// test_simulation_sop_basic_11_test.v
module f2_test(input [3:0] in, input [1:0] select, output reg out);
alwa... |
// ----------------------------------------------------------------------------
// Module: memory.v
// Project: MOS 6502 Processor
// Author: George Castillo <>
// Date: 23 April 2018
//
// Description: Behavioral model for a 64kB asynchronous memory. The module
// reads a text file into a large array and then eit... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 12:52:08 03/28/2014
// Design Name:
// Module Name: aluc
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies :
//
// R... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: scfifo
// ============================================================
// File Name: sfifo_82x256_la.v
// Megafunction Name(s):
// scfifo
//
// Simulation Library Files(s):
// altera_mf
// ===========================... |
///////////////////////////////////////////////////////////////////////////////
//
// 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 main() { long long int t = 1; ios_base::sync_with_stdio(false); cin.tie(NULL); while (t--) { long long int i, j, k, m, n, ans = 0; cin >> n >> k; if (n >= k) n = k - 1; if (k - n >= n) { cout << 0; return 0; ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> id(n + 1); for (int i = 0; i < n; i++) { int x; cin >> x; id[x] = i; } vector<int> dp(n + 1, 1); for (int i = 2; i <= n; i++) { ... |
module erx (/*AUTOARG*/
// Outputs
rx_lclk_pll, rxo_wr_wait_p, rxo_wr_wait_n, rxo_rd_wait_p,
rxo_rd_wait_n, rxwr_access, rxwr_packet, rxrd_access, rxrd_packet,
rxrr_access, rxrr_packet, erx_cfg_wait, timeout, mailbox_full,
mailbox_not_empty,
// Inputs
erx_reset,erx_ioreset, sys_reset, sys_clk, rx_l... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin >> t; while (t--) { bool f = false; set<int> v1; int n, ans = -1; cin >> n; int a[n]; for (long long i = 0; i < n; 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 la... |
#include <bits/stdc++.h> using namespace std; int Scan(); int n, m, w, num; double aver, cur[105]; vector<pair<int, double> > res[105]; double place(double V, int i) { double D = aver - cur[num]; double L = min(D, V); res[num].push_back(make_pair(i, L)); cur[num] += L; if (fabs(cur[num] ... |
#include <bits/stdc++.h> int nextInt() { int x; scanf( %d , &x); return x; } double nextDouble() { double x; scanf( %lf , &x); return x; } long long nextLong() { long long x; scanf( %I64d , &x); return x; } char nextChar() { char x; scanf( %c , &x); return x... |
// -- (c) Copyright 2010 - 2011 Xilinx, Inc. All rights reserved.
// --
// -- This file contains confidential and proprietary information
// -- of Xilinx, Inc. and is protected under U.S. and
// -- international copyright and other intellectual property
// -- laws.
// --
// -- DISCLAIMER
// -- This disclaimer is not a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.