text stringlengths 59 71.4k |
|---|
module ID(instr, imm, p0Addr, p1Addr, regAddr, shamt, aluOp, branchOp, regRe0, regRe1, regWe, memRe, memWe, addz, branch, jal, jr, aluSrc0, aluSrc1, ovEn, zrEn, neEn);
input [15:0] instr;
output [11:0] imm;
output [3:0] p0Addr, p1Addr, regAddr, shamt;
output [2:0] aluOp, branchOp;
// Control signals
outp... |
// file: dcm_exdes.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 not 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... |
#include <bits/stdc++.h> using namespace std; const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; const int INF = 1000000000; const long long LINF = 1000000000000000000; const long long MOD = 1000000007; const double PI = acos(-1.0); const double EPS = 1e-10; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c; cin >> n; vector<int> t(3); for (int &i : t) { cin >> i; } sort(t.begin(), t.end()); c = t[0]; b = t[1]; a = t[2]; int x, y, z; int max = 0; for (z = n / c; z >= 0; z--) { for (y = ... |
/**
* 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> #pragma GCC optimize( O3 ) using namespace std; int n, a[200005]; long double eps = 1e-11, b[200005], s[200005]; long double f(long double first) { long double mn = 0, ans = 0; for (int i = 1; i <= n; i++) { b[i] = -first + a[i]; s[i] = s[i - 1] + b[i]; ans =... |
#include <bits/stdc++.h> using namespace std; int main(void) { ios_base::sync_with_stdio(false); cin.tie(NULL); long long n, x, y; cin >> n; vector<pair<long long, long long>> a, b; for (long long i = 0; i < n; i++) { cin >> x >> y; a.push_back(make_pair(x, y)); } for (lo... |
#include <bits/stdc++.h> using namespace std; const int N = 123456; const int mod = 1e9 + 7; class table { public: int id; int size; }; class group { public: int id; int size; int income; }; bool byIncome(const group &r1, const group &r2) { return r1.income > r2.income; }... |
`timescale 1ns / 1ps
module fifo
#(
parameter DATA_WIDTH = 8,
parameter FIFO_DEPTH = 12
)
(
input wire reset,
output reg [FIFO_DEPTH:0] count,
output reg full,
// IN PORT
input wire [DATA_WIDTH-1:0] d... |
#include <bits/stdc++.h> using namespace std; const int N = 5e4 + 10, K = 256, B = 16; int a[N], parent[N], depth[N], up[N], ans[N][K]; vector<int> g[N]; bitset<(1 << (B + 1)) + 10> trie; void make_tries(int i, int par); void trie_insert(int val); void trie_clear(int val); int trie_max(int val); int... |
/*
* 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); cin.tie(0); cout.tie(0); pair<int, int> a[101]; int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i].first >> a[i].second; } int t; cin >> t; for (int i = n - 1; i >= 0; 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; template <typename T, typename U> inline void smin(T &a, U b) { if (a > b) a = b; } template <typename T, typename U> inline void smax(T &a, U b) { if (a < b) a = b; } int power(int a, int b, int m, int ans = 1) { for (; b; b >>= 1, a = 1LL * a *... |
#include <bits/stdc++.h> using namespace std; priority_queue<pair<long long, int>, vector<pair<long long, int> >, greater<pair<long long, int> > > q; struct node { int left, right, num[3]; } tree[4 * 100010]; struct NODE { int begin, end, value, next; } edge[50 * 100010 + 10];... |
#include <bits/stdc++.h> using namespace std; vector<int> V[100045]; double size[100045]; int par[100045]; double ans[100045]; void dfs(int v) { size[v] = 1; for (int i = 0; i < V[v].size(); i++) dfs(V[v][i]); for (int i = 0; i < V[v].size(); i++) size[v] += size[V[v][i]]; } void bfs(int st)... |
/*Converts an emesh bundle into a 104 bit packet*/
module emesh2packet(/*AUTOARG*/
// Outputs
packet_out,
// Inputs
access_in, write_in, datamode_in, ctrlmode_in, dstaddr_in, data_in,
srcaddr_in
);
parameter AW=32;
parameter DW=32;
parameter PW=104;
//Emesh signal bundle
input ... |
module gost89_mac(
input clk,
input reset,
input load_data,
input [511:0] sbox,
input [255:0] key,
input [63:0] in,
output reg [31:0] out,
output reg busy
);
reg [4:0] counter;
reg [31:0] round_key;
reg need_xor;
reg [31... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int MAXN = 3e6 + 9; long long n, k; long long two(long long x) { long long base = 1, ans = 0; while (base * x <= n) { long long f = min(n, base * (x + 1) - 1); ans += f - base * x + 1; base *= 2; } r... |
#include <bits/stdc++.h> using namespace std; long long ten[20], a, b, l, ans = (long long)1 << 40; long long lp, rp, mp, mt; int ls, rs, ms; int calc(long long x) { int y = 0; for (; x; x /= 10) if (x % 10 == 4 || x % 10 == 7) ++y; return y; } void askl() { lp = a; ls = -1; ... |
// ***************************************************************************
// ***************************************************************************
// 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> using namespace std; int main() { int t; cin >> t; while (t--) { long long a, b, c, n, sum = 0, Max, Min; cin >> a >> b >> c >> n; Max = max(max(a, b), c); sum = a + b + c; if (3 * Max - sum > n) cout << NO << endl; else { su... |
#include <bits/stdc++.h> using namespace std; const int MAX = 66; int power[MAX + 10]; int between[MAX + 10]; int extra[MAX + 10]; int ende[MAX + 10]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { long long foo; cin >> foo; int cc = 0; bool good = true; ... |
#include <bits/stdc++.h> using namespace std; int a[1234]; int main() { int n; scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %d , a + i); int mx = 0; for (int i = 0; i < n; i++) if (a[i] > mx) mx = a[i]; for (int u = 1; u <= mx; u++) { for (int i = 0; i < n; i++) { ... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:36777216 ) using namespace std; const int INF = ~(1 << 31); const double EPS = 1; const double PI = 3.141592653589793; int main() { int n, m; cin >> n >> m; if (m == 3 && n >= 5) { cout << -1 n ; return 0; } for (int i... |
#include <bits/stdc++.h> using namespace std; char num[200001]; int numLen, m, temp, answer = 0; int stepArr = 1; int main() { cin >> num >> m; numLen = strlen(num); answer += (num[numLen - 1] - 48) % m; for (int i = numLen - 2; i >= 0; i--) { stepArr = (stepArr * 10) % m; answer +... |
module prefab_alu_rf;
parameter sim_time = 750*2; // Num of Cycles * 2
reg [31:0] Pcin;
reg [19:0] RSLCT;
reg Clk, RESET, LOADPC, LOAD,IR_CU;
wire [31:0] Rn,Rm,Rs,PCout,in;
//RegisterFile(input [31:0] in,Pcin,input [19:0] RSLCT,input Clk, RESET, LOADPC, LOAD,IR_CU, output [31:0] Rn,Rm,Rs,PCout);
RegisterFile RF(in,P... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19:40:01 08/24/2014
// Design Name:
// Module Name: ps2_kbd
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
//... |
#include <bits/stdc++.h> using namespace std; const int N = 1005; int l[N][N], r[N][N], u[N][N], z[N][N]; int v[N][N]; void swap_left(int f, int g) { int fi = f / N; int fj = f % N; int gi = g / N; int gj = g % N; swap(l[fi][fj], l[gi][gj]); int ai = l[fi][fj] / N; int aj = l[fi][f... |
#include <bits/stdc++.h> using namespace std; int main() { int d, n, d1 = 1, a; long long cnt = 0; cin >> d >> n; for (int i = 0; i < n; i++) { cin >> a; d1 = a; if (i != n - 1 && d1 != d) { cnt += d - d1; d1 = 1; } else if (d1 == d) { d1 = 1; } ... |
#include <bits/stdc++.h> using namespace std; int const MAXN = 2e5 + 10; int n, m, T; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> m; int t = 0; while (m) { t = 10 * t + m % 10; m /= 10; } cout << n + t; return 0; } |
#include <bits/stdc++.h> using namespace std; int a[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; vector<int> parse(string s) { int i, dd, mm, yy; for (int i = 0; i < (int)(s.length()); i++) if (s[i] == . ) s[i] = ; istringstream ss(s); ss >> dd >> mm >> yy; vector<int> ans; ... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 20:21:38 07/31/2014
// Design Name: huffman_decoder
// Module Name: C:/Documents and Settings/paulmoon/Desktop/SENG440/huffman/huffman_testbench.v
// Project... |
#include <bits/stdc++.h> using namespace std; inline int read() { int ret = 0, t = 1; char c = getchar(); while ((c < 0 || c > 9 ) && c != - ) c = getchar(); if (c == - ) t = -1, c = getchar(); while (c >= 0 && c <= 9 ) ret = ret * 10 + c - 0 , c = getchar(); return ret * t; } c... |
#include <bits/stdc++.h> using namespace std; int main() { double a, b, c, d, e, f; cin >> a >> b; for (int i = 0; i < a; i++) { cin >> c >> d; e = c / d; if (i > 0) f = min(e, f); else if (i == 0) f = e; } printf( %.08f n , f * b); return 0; } |
#include <bits/stdc++.h> using namespace std; vector<set<int> > graph; vector<int> eliminar; set<int>::iterator ite; void elim(int N) { eliminar.clear(); for (int i = 1; i <= N; i++) if (graph[i].size() == 1) eliminar.push_back(i); } int main() { int n, m, n1, n2, temp, contador; cin... |
// DESCRIPTION: Verilator: Verilog Test module
//
// Copyright 2009 by Wilson Snyder. This program is free software; you can
// redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License
// Version 2.0.
`ifdef VCS
`define NO_SHORTREAL
`en... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; long long int a[n], mx = 0; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] > mx) mx = a[i]; } long long int freq[mx + 1]; for (int i = 0; i < mx + 1; i++) { freq[i] = 0; } ... |
#include <bits/stdc++.h> using namespace std; const int N = 200001; long long int sz[N], dist[N], every[N]; vector<int> adj[N]; int n, k; void dfs(int start, int p = -1) { for (auto child : adj[start]) { if (child != p) { dfs(child, start); sz[start] += sz[child]; dist[star... |
#include <bits/stdc++.h> using namespace std; bool isOk(char c, int v) { return v == (c == B ? -1 : 1); } int main() { int n, m; scanf( %d %d , &n, &m); string a[n]; int v[n][m]; char ch; int vx; int nOp = 0; for (int i = 0; i < n; i++) { fill(v[i], v[i] + m, 0); cin ... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.4
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1 ns / 1 ... |
#include <bits/stdc++.h> using namespace std; int rem = 1000000007; vector<long long> v; vector<long long> d(21); vector<long long> down(21); long long n, s; long long binpow(long long a, long long n) { if (n == 0) return 1; long long tmp = binpow(a, n / 2); if (n & 1) return tmp * tmp % rem *... |
#include <bits/stdc++.h> using namespace std; const int N = 1234567; vector<int> rev[N]; char foo[N]; int on_cycle[N]; int digit[N], to[N]; bool found; void dfs(int v, int pos) { if (pos < 0) { found = true; } if (found) { return; } int sz = rev[v].size(); for (int j ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 205; const int P = 998244353; template <typename T> void chkmax(T &x, T y) { x = max(x, y); } template <typename T> void chkmin(T &x, T y) { x = min(x, y); } template <typename T> void read(T &x) { x = 0; int f = 1; ... |
#include <bits/stdc++.h> using namespace std; long long int power(long long int x, unsigned long long int y) { long long int res = 1; while (y > 0) { if (y & 1) { res = res * x; } y = y >> 1; x = x * x; } return res; } long long int powermod(long long int x, unsig... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21:16:09 07/10/2009
// Design Name:
// Module Name: spi
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// R... |
/*
module MODULE2 ( A, B, C );
input A;
input B;
input C;
endmodule
*/
module MODULE1();
wire [9:0] lq;
//module MODULE1(lq);
// input [9:0] lq;
// input dummy;
// wire [9:0] lq;
wire [2:0] dummy;
// MODULE2 INSTANCE ( .A(lq[9]), .B(lq[4]), .C(lq[1]), .D(dummy[0]), .E(dummy) );
// MODULE2 INSTANCE ( .A(lq[9]), ... |
#include <bits/stdc++.h> using namespace std; long a[1000000], m, n, i, j, k, l, ma, mi; int main() { cin >> n; for (i = 1; i <= n; i++) cin >> a[i]; if (n <= 2) { cout << -1 << endl; return 0; } for (i = 1; i <= n - 2; i++) if (a[i] != a[i + 2]) { if (a[i] == a[i + 1... |
#include <bits/stdc++.h> #pragma GCC optimize( -Ofast,unroll-loops ) #pragma GCC target( avx2 ) std::mt19937 rnd(237); using namespace std; const int N = 2e5, mod = 1e9 + 7; int n, m, type[N], cmp[N], cmp_p = 0; vector<array<int, 2>> g1[N], g2[N]; long long dfs(int v) { cmp[cmp_p++] = v; long lo... |
/////////////////////////////////////////////////////////////////////
//// ////
//// FPU ////
//// Floating Point Unit (Double precision) ////
//// ... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } const int MAXN = 16; int n; int mod[MAXN], rem[MAXN]; int egcd(int a, int b, int &x, int &y) { if (b == 0) { x = 1, y = 0; return a; } int g = egcd(b, a % b, x... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5; int n, m; int fir[N + 10][2], nex[N + 10][2], tot[2], en[N + 10][2]; int tag[N + 10][2], vis[N + 10]; void addEdge(int x, int y, int p) { tot[p]++; nex[tot[p]][p] = fir[x][p]; fir[x][p] = tot[p]; en[tot[p]][p] = y; } void d... |
#include <iostream> #include <cmath> #include <algorithm> #include <vector> #include <set> #include <unordered_set> #include <queue> #include <deque> #include <string> #include <sstream> #include <iomanip> #include <map> #include <unordered_map> #include <stack> #include <cstdio> #include ... |
/**
* 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... |
/*
*
* Clock, reset generation unit for ML501 board
*
* Implements clock generation according to design defines
*
*/
//////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2009, 2010 Authors and OPENCORES.O... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; char a[n][m]; int c = 0; int column_no; int row_number; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) { cin >> a[i][j]; if (a[i][j] == B && c == 0) { column_no ... |
#include <bits/stdc++.h> using namespace std; inline int in() { int x; scanf( %d , &x); return x; } inline void priv(vector<int> a) { for (int i = 0; i < ((int)(a).size()); ++i) printf( %d%c , a[i], i == (int)(a).size() - 1 ? n : ); } template <typename T> istream& operator>>(i... |
/****************************************************************************
MUL/DIV unit
Operation table
op
0 MULTU
1 MULT
****************************************************************************/
module mul (clk, resetn,
opA, opB,
op, ... |
// MBT 7/7/16
//
// bsg_channel_tunnel
//
// This module allows you to multiplex multiple streams over a shared
// interconnect without having deadlock occur because of stream interleaving.
//
// There are three models for interleaving streams:
//
// a. Your stream is guaranteed to be sunk by the remote node without
/... |
#include <bits/stdc++.h> using namespace std; int a[1010], seq[1010], id; int qtes, u[1000010], v[1000010]; inline void add(int x, int y) { a[y] -= a[x], a[x] *= 2, u[++qtes] = x, v[qtes] = y; } inline void Solve(int x, int y, int z) { int q[3] = {x, y, z}; register int i, j; for (i = 0; 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 into the Public Domain, for any use,
// without warranty, 2015 by Iztok Jeras.
// SPDX-License-Identifier: CC0-1.0
`define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", `__FILE__,`__LINE__,... |
//Legal Notice: (C)2015 Altera Corporation. All rights reserved. Your
//use of Altera Corporation's design tools, logic functions and other
//software and tools, and its AMPP partner logic functions, and any
//output files any of the foregoing (including device programming or
//simulation files), and any associated do... |
#include <bits/stdc++.h> using namespace std; const int M = 1e9 + 7; int INF = 1e6; long long int n, m; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; long long int i, j, t, k, x, y, z, N; cin >> n; long long int a[n], b[n], c[n]; for (i = 0; i < n; i++) cin >... |
#include <bits/stdc++.h> using namespace std; char c[2000007]; set<int> s; int main() { int n; scanf( %d , &n); for (int i = 0; i < 2000007; i++) { s.insert(i); } set<int>::iterator it; int maxy = 0; for (int i = 0; i < n; i++) { string l; cin >> l; int k; ... |
#include <bits/stdc++.h> using namespace std; int main() { int T; cin >> T; while (T--) { int flag = 0; int n; int now; cin >> n >> now; int l = now, r = now; int past = 0; for (int i = 0; i < n; i++) { int len, lb, rb; cin >> len >> lb >> rb; ... |
#include <bits/stdc++.h> using namespace std; long long suf(long long a) { return (a * (a + 1)) / 2; } const long long OO = 1e6 + 10, MOD = 1e9 + 7; vector<vector<int> > adj, can; int dx[]{1, -1, 0, 0, 1, -1, 1, -1}; int dy[]{0, 0, 1, -1, 1, -1, -1, 1}; int main() { std::ios_base::sync_with_stdio(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; bool M[3000][6000]; int dr[] = {-1, -1, -1, 0, 0, 1, 1, 1}; int dc[] = {-1, 0, 1, -1, 1, -1, 0, 1}; int parent[18000000]; int Find(int x) { if (parent[x] != x) parent[x] = Find(parent[x]); return parent[x]; } void Union(int x, int y) { x = Find(x... |
#include <bits/stdc++.h> using namespace std; const int nn = 115; const double PI = 2 * acos(0); int main() { int n; double r; double ans; cin >> n >> r; double x = (PI * (180 - (360.0 / n)) / 2.0) / 180.0; double L = 0, R = 1e5; while (L <= R) { double mid = (L + R) / 2.0; ... |
#include <bits/stdc++.h> using namespace std; int _; long long a1, a2, b1, b2, c1, c2; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> a1 >> a2 >> b1 >> b2 >> c1 >> c2; if ((c2 - b2) * (c1 - a1) == (c2 - a2) * (c1 - b1)) { cout << No ; } else if ((a1 - b1) * (a1 - b1) + (... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; t = 1; while (t--) { double n; cin >> n; double a[200001], sum = 0; set<double> s; for (int i = 0; i < n; i++) { cin >> a[i]; ... |
#include <bits/stdc++.h> using namespace std; const int inf = 2e9; const long long Inf = 1e10; const int N = 500005; const double pi = acos(-1); inline int IN() { int x = 0; int ch = 0, f = 0; for (ch = getchar(); ch != -1 && (ch < 48 || ch > 57); ch = getchar()) f = (ch == - ); for (... |
#include <bits/stdc++.h> using namespace std; int main() { long long c, hr, hb, wr, wb; cin >> c >> hr >> hb >> wr >> wb; long long res = 0; for (long long w = 0; w < 2; ++w) { for (long long i = 0; i * wr <= c && i <= 10000000; ++i) { res = max(res, i * hr + hb * ((c - i * wr) / wb));... |
#include <bits/stdc++.h> using namespace std; const int N = 100100; int n, a[N], b[N], aa[N], bb[N]; long long ans; void go(int i, int x) { if (ans == 0) return; if (x == 1) { if (a[i + 1] == 9) go(i + 1, -1); if (ans == 0) return; cout << i + 1 << << 1 << n ; --ans; ... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, len, vf, va, k; cin >> n >> len >> vf >> va >> k; long long bl = (n + k - 1) / k; double eff = static_cast<double>(va - vf) / (va + vf); double koef = (va + (bl + (bl - 1) * eff - 1) * vf); double ta = len / koef; do... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: c2i_buf.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 it and/or
//... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 1; const int N = 5003; vector<int> adj[N]; vector<pair<int, int> > stores[N]; bool done[N]; int dist[N]; void clear(int n) { for (int i = 1; i <= n; ++i) done[i] = 0; } void modify(multiset<pair<int, int> >& tiendas, const int& ... |
/////////////////////////////////////////////////////////////////////
//// ////
//// JPEG Quantization & Rounding Core ////
//// ////
//// Author: Richard Herveille ... |
#include <bits/stdc++.h> using namespace std; const int inf = (1 << 30) - 1; const int maxn = 110; int n, m, K; long long f[maxn][maxn][maxn]; int col[maxn]; long long p[maxn][maxn]; int main() { scanf( %d%d%d , &n, &m, &K); for (int i = 1; i <= n; i++) scanf( %d , &col[i]); for (int i = 1; ... |
#include <bits/stdc++.h> using namespace std; struct info { int d, f, t, cst; } inp[100006]; int forw[1000005]; int forw2[1000005]; long long cforw[1000005]; long long cforw2[1000005]; int ok[1000006]; int ok2[1000006]; bool cmp(info a, info b) { return a.d < b.d; } void process1(int prev, int... |
#include <bits/stdc++.h> using namespace std; int n, m; int score(pair<int, int> a) { int d = abs(a.first - a.second); return min(d, n - d); } const int N = 1e5 + 7; int nxt[N], prv[N]; vector<int> regions[N]; vector<int> adj[N]; int level[N]; int sz[N]; void dfs1(int u, int par) { ass... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1000 + 10; long long n, m, a, b; long long arr[maxn][maxn]; long long sum[maxn][maxn]; long long Min[maxn][maxn]; set<pair<long long, pair<long long, long long> > > s; multiset<long long> s_; long long minr[maxn][maxn]; long long ground[... |
//#############################################################################
//# Function: Programmable Interrupt Controller #
//#############################################################################
//# Author: Andreas Olofsson #
... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are... |
#include <bits/stdc++.h> using namespace std; vector<pair<long long, int> > v; int n; long long A[100005]; long long B[100005]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) { int a, b; scanf( %d %d , &a, &b); A[i] = (long long)a; B[i] = (long long)b; v.pus... |
#include <bits/stdc++.h> using namespace std; int main() { int n, s, i, v = 0, a[1010]; cin >> n >> s; for (i = 1; i <= n; i++) { cin >> a[i]; v = v + a[i]; } for (i = 1; i <= n; i++) if ((v - a[i]) <= s) { cout << YES ; return 0; } cout << NO ; ... |
`timescale 1ns/1ps
module lookup_9bit(
clk,
reset,
set_valid,
set_data,
read_valid,
read_addr,
data_out_valid,
data_out,
key_valid,
key,
//bv_valid,
bv,
stage_enable
);
input clk;
input reset;
input set_valid;
input [44:0] set_data;
input read_valid;
input [8:0] read... |
#include <bits/stdc++.h> using namespace std; const int N = 200005; vector<int> adj[N]; int n, st[N], sz[N], flat[N], tim = 1; int dfs(int u) { int s = 1; st[u] = tim; flat[tim] = u; for (int v : adj[u]) { tim++; s += dfs(v); } return sz[u] = s; } int main(int argc, cha... |
/**
* 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 remap(
input logic [2047:0] mem_data_out,
output logic [15:0] sdma_address_low,
output logic [15:0] sdma_address_high,
output logic [15:0] block_size,
output logic [15:0] block_count,
ou... |
//*****************************************************************************
// (c) Copyright 2009 - 2013 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... |
// ============================================================================
// Copyright (c) 2012 by Terasic Technologies Inc.
// ============================================================================
//
// Permission:
//
// Terasic grants permission to use and modify this code for use
// in synthesis for... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; const int maxn = 2e6 + 10; int a[maxn], cnt[maxn]; long long sum[maxn]; int main(void) { int n, x, y; scanf( %d %d %d , &n, &x, &y); int z = x / y; for (int i = 1; i <= n; i++) scanf( %d , a + i), cnt[a[i]]++, su... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; const long long mod = 1e9 + 7; const long long N = 1e5 + 10; int main() { ios::sync_with_stdio(false); long long n; cin >> n; vector<pair<long long, long long> > v(n); for (long long i = 0; i < n; i++) cin >> v[i].fi... |
#include <bits/stdc++.h> using namespace std; long long memo[4][1001][1001]; long long mp[1001][1001]; int n, m; long long REC(int x, int y, int st) { if (x >= n || y >= m || x < 0 || y < 0) return 0; if (st == 0 && x == n - 1 && y == m - 1) return mp[x][y]; if (st == 1 && x == 0 && y == 0) return... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, k; cin >> n >> k; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; vector<int> f(n, 0); unordered_map<int, vector<int>> mp; for (int i = 0; i < n; i++) mp[... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.