text stringlengths 59 71.4k |
|---|
/*
* 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... |
/**
* 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; const int maxn = 150005; const int INF = 0x3f3f3f3f, MOD = 1e9 + 7; const double pi = 3.14159265359; int n, t[maxn], ans, cnt; vector<int> v, vp; inline bool check(const vector<int> &vt) { for (const int &i : vt) { if (i == 0) { if (t[i] >= t... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2011 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc=0;
reg [63:0] crc;
reg [63:0] sum;
parameter DW = 4;
wire [3:0] d... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k, m, t; scanf( %d %d %d %d , &n, &k, &m, &t); for (int i = 1; i <= t; ++i) { int x, y; scanf( %d %d , &x, &y); if (x) { if (y <= k) { k++; } n++; printf( %d %d n , n, k); ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 5010; const int INF = 1e5; static int N, val[MAXN], dp[MAXN][MAXN][2]; int main() { scanf( %d , &N); for (int i = 1; i <= N; i++) scanf( %d , &val[i]); val[0] = -INF; memset(dp, 0x3f, sizeof dp); dp[0][0][0] = dp[1][0][0] = dp[... |
#include <bits/stdc++.h> using namespace std; const int N = 200100; const int M = 2 * N; const long long MOD1 = 98764321261LL; const long long MOD = 998244353LL; inline int lowbit(int x) { return x & (-x); } struct fenwick { long long a[N]; int n; void init(int n) { for (int i = 0; i <= ... |
#include <bits/stdc++.h> using namespace std; int main() { int t, n, k, tmp; vector<long long> ans; vector<int> vec; cin >> t; while (t--) { cin >> n >> k; for (int i = 0; i < n * k; i++) { cin >> tmp; vec.push_back(tmp); } int med; if (n % 2 == 0) ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, q, m; cin >> n; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); cin >> q; while (q--) { cin >> m; cout << upper_bound(a, a + n, m) - a << endl; } } |
//----------------------------------------------------------------------------
//-- Asynchronous serial receiver Unit
//------------------------------------------
//-- Juan Gonzalez (Obijuan)
//-- GPL license
//----------------------------------------------------------------------------
//-- Tested at the standard baud... |
#include <bits/stdc++.h> using namespace std; void solve(int d) { cout << fixed << setprecision(9); if (d == 0) { cout << Y << 0.0 << << 0.0; } else if (d >= 1 && d < 4) cout << N ; else { double D = sqrt(d * (d - 4)); double a = (d + D) / 2.0; double b = (d - D... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 10; int tree[maxn * 4], add[maxn * 4]; void push(int v, int tl, int tr) { if (add[v] != 0) { tree[v] += add[v]; if (tl != tr) { int vv = v + v; add[vv] += add[v]; add[vv + 1] += add[v]; tree[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; int n, k, h; int m[100001]; int v[100001]; int id[100001]; int match[100001]; int res[100001]; double eps = 1e-9; void qsort1(int, int); void qsort2(int, int); bool ok(double); int main() { cin >> n >> k >> h; for (int i = 1; i <= n; i++) { ... |
// synopsys translate_off
`timescale 1 ps / 1 ps
// synopsys translate_on
module ram (addr_rd, addr_rw, clock, data, wren, q, q_rw);
input clock;
input [13:0] addr_rw;
input [7:0] data;
input wren;
input [13:0] addr_rd;
output [7:0] q;
output [7:0] q_rw;
`ifndef ALTERA_RES... |
/**
* 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 comment(linker, /STACK:255000000 ) bool firstout = 1; template <class T> T &minn(T &a, T b) { if (b < a) a = b; return a; } template <class T> T &maxx(T &a, T b) { if (a < b) a = b; return a; } int &madd(int &a, int b) { 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 N = 1000000; int k; int n; vector<int> v; int read() { scanf( %d %d , &n, &k); for (int i = 1; i <= n; i++) { int t; scanf( %d , &t); v.push_back(t); } sort(v.begin(), v.end()); printf( %d , v[n - k]); return 0... |
//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; int N, memo[1 << 25]; pair<int, int> arr[30]; int dist(int a, int n) { int k1 = arr[n].first - arr[a].first; int k2 = arr[n].second - arr[a].second; return k1 * k1 + k2 * k2; } int dp(int mask) { if (__builtin_popcount(mask) == N) { return ... |
#include <bits/stdc++.h> using namespace std; int main() { unsigned n, m; cin >> n >> m; if (n % 2 != 0 && m % 2 != 0) cout << ((m * n) - 1) / 2; else cout << (m * n) / 2; return 0; } |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; const int MOD = 1000000007; void solve() { int n; cin >> n; vector<vector<int>> dp(4, vector<int>(n + 1, 0)); dp[3][0] = 1; for (int i = 1; i < n + 1; i++) for (int j = 0; j < 4; j++) for (int k = 0; k < 4; k+... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: bw_clk_cl_ctu_cmp.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... |
#include <bits/stdc++.h> using namespace std; const int N = 2E5 + 10, mod = 1E9 + 7, M = 1E6 + 10, lim = 1E6; int n, m, a[N], s[N], ans[N]; struct node { int l, r, num; } p[N]; vector<int> f[M]; int pos[M]; inline int cmp(node x, node y) { return x.r < y.r; } struct sgtree { int l, r, sum; }... |
#include <bits/stdc++.h> using namespace std; long long int p[200008] = {0}; int main() { ios_base::sync_with_stdio(false); long long int n, z, x, i; long double p, q; cin >> n; for (i = 0; i < n; i++) { cin >> x; z = x * x - 4 * x; if (z < 0) { cout << N n ; ... |
#include <bits/stdc++.h> using namespace std; int solve() { int n; cin >> n; if (n == 1) return cout << -1 << endl, 0; string s = ; for (int i = 0; i < n - 1; i++) s += 3 ; cout << 2 + s << endl; return 0; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(... |
#include <bits/stdc++.h> using namespace std; const int inf = 1e9 + 7; string to_string(string s) { return + s + ; } string to_string(char s) { return string(1, s); } string to_string(const char *s) { return to_string((string)s); } string to_string(bool b) { return (b ? true : false ); } templat... |
#include <bits/stdc++.h> using namespace std; vector<int> v[3 * 100005]; int n, m, nr, h[3 * 100005], f[3 * 100005], a[3 * 100005], b[3 * 100005], t[3 * 100005], q; void dfs(int x) { for (auto it : v[x]) if (h[it] == 0) { t[it] = x; h[it] = h[x] + 1; dfs(it); } } ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); long long n; cin >> n; cout << 2 * n - 1 << << 2 << n ; cout << 1 << << 2 << n ; } |
`timescale 1ns / 1ps
module tx_DS_sel(
input txClk,
input txReset,
input ready_i,
input reqTimecode_i,
input reqSpaceAvail_i,
input reqData_i,
input reqIdle_i,
input [8:0] dat_i,
output ackTimecode_o,
output ackSpaceAvail_o,
output ackData_o,
output ackIdle_o,
output valid_o,
output [8:0] da... |
// (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... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 106; int g[MAX_N][MAX_N]; int h[MAX_N][MAX_N]; bool not_empty_row[MAX_N]; bool not_empty_col[MAX_N]; bool used_row[MAX_N]; bool used_col[MAX_N]; void coppy(int n, int m) { for (int i = 1; n >= i; i++) { for (int j = 1; m >= j; j... |
#include <bits/stdc++.h> using namespace std; long double a[(1000000)], x[(1000000)]; long double b[(1000000)], y[(1000000)]; int n, A, B; long double ans; const long double inf = 3e9; bool check(double t) { int k = B; long double cnt = inf * inf; for (int i = A; i > 0; i--) { while (k &... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; const long long UNDEF = -1; const long long INF = 1e18; template <typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; } template <typename T> inline bool chkmin(T &aa, T bb) { return aa ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, i; long long h, k, a[100005], cnt = 0; cin >> n >> h >> k; for (i = 0; i < n; i++) cin >> a[i]; long long carry = 0; for (i = 0; i < n; i++) { if (carry + a[i] <= h) { ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = 0; i < n; ++i) a.push_back(a[i]); int Max = 0, cur = 0; for (int i = 0; i < 2 * n; ++i) { if (a[i] == 1) cur++; else { ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/*
* 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 = 4e5 + 5; int n, m, fa[N], b[N], ans; struct edge { int u, v, w; } e[N]; bool cmp(edge x, edge y) { return x.w > y.w; } int find(int x) { return x == fa[x] ? x : fa[x] = find(fa[x]); } int main() { scanf( %d%d , &n, &m); for (registe... |
/**
* 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> int minx, miny, minz, maxx, maxy, maxz, n, m, Q, x, y, z, mx1, mn1, mx2, mn2, mx3, mn3, D, cnt; using namespace std; struct node { int l, r, maxx, maxy, maxz, minx, miny, minz, d[3]; } t[2000005]; inline bool cmp(node aa, node bb) { if (aa.d[D] == bb.d[D]) { if (aa... |
/**
* 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 MX = 100; long long A[MX][MX]; long long acum[MX][MX]; long long n, m; long long getAns(long long a, long long b) { long long ans = n * m; for (long long i = 0; i < n; i++) { for (long long j = 0; j < m; j++) { if (i + a - 1... |
//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 main() { string s; cin >> s; int a = 1; for (int i = 1; i < s.size(); i++) { if (s[i] == 1 ) { a += 10; } else { a += s[i] - 0 ; } } cout << a << n ; } |
/*
* 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; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(30); ; int c = 0, z, n; string a, b, s, t; cin >> a >> b; int x = a.size(); int y = b.size(); if (x > y) { a.swap(b); z = x; x = y... |
#include <bits/stdc++.h> char abc[1000001]; int main() { char ab[1000001]; scanf( %s , ab); int abcc = strlen(ab); int i, x = 0, y = 0; for (i = 0; i < abcc; i++) { x += ab[i] == x ? 1 : 0; y += ab[i] == y ? 1 : 0; } if (x > y) for (i = 0; i < x - y; i++) abc[i] = ... |
//-------------------------------------------------------------------------------
//--tb_FinalProject.v---------------------------------------------------------
//--By Kyle Williams, 11/20/2012-------------------------------------------------
//--PROJECT DESCRIPTION------------------------------------------------------... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e3 + 10; int a[maxn], b[maxn]; int dp[2][maxn][55][55]; inline int ip(int k) { return k > 0 ? k : 0; } int main() { ios::sync_with_stdio(false); cin.tie(0); int n, p, k; cin >> n >> p >> k; int r, s; cin >> r; for (i... |
#include <bits/stdc++.h> using namespace std; int main(void) { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n; cin >> n; long long all = 0; long long ans = 0; for (long long i = 0; i < n; i++) { long long x; cin >> x; ans = max(ans, x); all ... |
#include <bits/stdc++.h> using namespace std; const int N = (int)1e7 + 7; const int Mx = (int)1e7; int n, m; int A[N], B[N]; int lp[N]; map<int, vector<int> > a, b; void precalc() { for (int i = 2; i <= Mx; i++) { if (!lp[i]) { lp[i] = i; if (i * 1ll * i <= Mx) { for ... |
#include <bits/stdc++.h> using namespace std; const int mxn = 1e5 + 10; int n, m; bool jest[410][410]; bool vis_sam[mxn], vis_poc[mxn]; int sam[mxn], poc[mxn]; void wczytaj() { scanf( %d%d , &n, &m); for (int i = 1; i <= m; i++) { int a, b; scanf( %d%d , &a, &b); jest[a][b] = tru... |
#include <bits/stdc++.h> using namespace std; int i, j, m, n, rev_dig[25], cnt, non_zero, anscnt; long long x, ans1[100005], ans2[100005], ans3[100005]; long long getinv(long long a, long long p) { if (a == 1) return 1; long long k = a - getinv(p % a, a); return (k * p + 1) / a; } void answer(lo... |
#include <bits/stdc++.h> using namespace std; struct node { int val, id; friend bool operator<(node a, node b) { return a.id > b.id; } }; int main() { int t, m, n; struct node p; while (~scanf( %d %d , &m, &n)) { priority_queue<node> a; priority_queue<node> b; int id = 0; ... |
#include <bits/stdc++.h> using namespace std; int a[5000]; int b[5000]; int main() { int n, m; cin >> n >> m; int x; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < m; i++) cin >> b[i]; sort(a, a + n); sort(b, b + m); int cura = 0; for (int i = 0; i < m && cura <... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, r, s; cin >> n; if (n % 2 == 1) { if (n == 1) { cout << -1 ; } else { r = (n * n - 1) / 2; s = (n * n + 1) / 2; cout << r << << s; } } else { if (n == 2) { cou... |
#include <bits/stdc++.h> using namespace std; int main() { int n, x; scanf( %d , &n); vector<int> cnt(20, 0); for (int i = 0; i < n; i++) { scanf( %d , &x); for (int b = 0; b < 20; b++) { if (1 & (x >> b)) cnt[b]++; } } long long ans = 0; for (int i = 0; i < n; ... |
#include <bits/stdc++.h> using namespace std; int n; int init[110]; string lst[110]; vector<int> fin; int main() { ios_base::sync_with_stdio(false); cin >> n; for (int i = (int)0; i < (int)n; ++i) cin >> lst[i]; for (int i = (int)0; i < (int)n; ++i) cin >> init[i]; bool flag = 1; whi... |
/*
* 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 Rand(time(0)); long long rnd(long long a) { return Rand() % a; } long long rnd(long long a, long long b) { return Rand() % (b - a + 1) + a; } double rnd_01d() { return (double)Rand() / (1ll << 32); } double rnd_d(double r) { return rnd_01d() * r; } con... |
`define ADDER_WIDTH 006
`define DUMMY_WIDTH 128
`define 2_LEVEL_ADDER
module adder_tree_top (
clk,
isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0, isum0_1_0_1, isum0_1_1_0, isum0_1_1_1,
sum,
);
input clk;
input [`ADDER_WIDTH+0-1:0] isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0,... |
#include <bits/stdc++.h> using namespace std; int n, r[1010], c[1010], rc[1010], rr[1010], tr[1010], tc[1010], rtc[1010], rtr[1010]; class portal { public: int ix, iy, ox, oy; }; vector<portal> ans; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &r[i]); ... |
#include <bits/stdc++.h> using namespace std; constexpr long long MOD = (long long)1e9 + 7; long long fexp(long long a, long long n) { a %= MOD; if (n == 0) return 1; long long ret = fexp(a * a % MOD, n / 2); if (n % 2 == 1) ret = ret * a % MOD; return ret; } long long blub(long long pa, l... |
#include <bits/stdc++.h> using namespace std; const int dr[] = {0, -1, 0, 1, -1, 1, 1, -1}; const int dc[] = {1, 0, -1, 0, 1, 1, -1, -1}; const double eps = 1e-9; template <class T> void print(const vector<T> &v) { ostringstream os; for (int i = 0; i < (int)v.size(); ++i) { if (i) os << ; ... |
/*
* 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... |
/*********************************************************************
* SYNOPSYS CONFIDENTIAL *
* *
* This is an unpublished, proprietary work of Synopsys, Inc., and *
* is fully protected under copyrigh... |
#include <bits/stdc++.h> using namespace std; void show_trace() { cout << endl; } template <typename Start, typename... Rem> void show_trace(Start S, Rem... R) { cout << << S; show_trace(R...); } const int INFi = 2139062143; const long long INF = 1e18; int main() { ios::sync_with_stdio(f... |
/**
* 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() { int n; scanf( %d , &n); unordered_map<int, int> m; for (int i = 0; i < n; i++) { int x; scanf( %d , &x); m[x]++; } int ans = 0; for (pair<int, int> x : m) ans += x.second / 2; printf( %d n , ans / 2); re... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, n; cin >> n >> a >> b; cout << min(n - a, b + 1); 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 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> int main() { int t; scanf( %d , &t); while (t--) { int n; scanf( %d , &n); std::vector<int> a(n); for (int i = 0; i < n; i++) { scanf( %d , &a[i]); } int minadd = 0; int cur = a[0]; for (int i = 1; i < n; i++) { if (c... |
// Copyright (c) 2015 Kareem Matariyeh
//
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int dp[N], a[N], n; int main() { cin >> n; for (int i = 0; i < n; ++i) scanf( %d , &a[i]); if (n == 1) { cout << 1; return 0; } for (int i = 0; i < n; ++i) { if (a[i] == 1) continue; int d = 2, mx = ... |
#include <bits/stdc++.h> using namespace std; int main() { float a, b, c, t; cin >> a >> b; if (a > b) swap(a, b); c = (b - a) / 2; t = floor(c); c = ceil(c); int f = 0, y = 0; for (int i = 1; i <= c; i++) { f += i; } for (int i = 1; i <= t; i++) { y += i; } ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e6 + 2; vector<int> g[MAXN]; int d[MAXN], low[MAXN], scc[MAXN]; bool stacked[MAXN]; stack<int> s; int ticks, current_scc; void tarjan(int u) { d[u] = low[u] = ticks++; s.push(u); stacked[u] = true; const vector<int> &out = g... |
/*
* yosys -- Yosys Open SYnthesis Suite
*
* Copyright (C) 2012 Clifford 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.
*
* T... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC target( sse4 ) using namespace std; template <class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; } template <class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; } mt19937 rng(chrono::steady_clo... |
#include <bits/stdc++.h> using namespace std; int n, m, q, cnt, f[400005]; int fnd(int x) { return f[x] == 0 ? x : f[x] = fnd(f[x]); } int main() { scanf( %d%d%d , &n, &m, &q); cnt = n + m - 1; for (int i = 1, x, y; i <= q; i++) { scanf( %d%d , &x, &y); y += n; x = fnd(x); 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 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... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.2
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1ns/1ps
... |
/**
* 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 x; int f(int a, int b) { return (a * b + 1) / 2; } bool ok(int n) { if (x == 3 && n == 3) return false; if (n % 2 == 0 && x % 4) return false; if (n % 2 == 0) { if (x / 4 <= f(n / 2 - 1, n / 2 - 1)) return true; return false; } in... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6; const int md = 1000000009; int n; long long two[maxn + 5], f[maxn + 5], ans; int main() { two[0] = 1; for (int i = 1; i <= maxn; ++i) two[i] = two[i - 1] * 2 % md; scanf( %d , &n); f[n] = 2; for (int i = n - 1; i >= 2; -... |
/*
* 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 law... |
/*
Distributed under the MIT license.
Copyright (c) 2015 Dave McCoy ()
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, mo... |
module myvrlg (
input wire rst,
input wire clk,
// rx_hs (consume data)
output wire rx_hs_ready,
input wire rx_hs_valid,
input wire [63:0] rx_hs_data,
// tx_hs (produce data)
input wire tx_hs_ready,
output wire tx_hs_... |
#include <bits/stdc++.h> int main(void) { int n, m, c1 = 0, c2 = 0, c3 = 0, c4 = 0, count = 0, i, j; scanf( %d%d n , &n, &m); char s[n + 1][m + 1]; for (i = 0; i < n; i++) { for (j = 0; j < m; j++) scanf( %c n , &s[i][j]); } for (i = 0; i < n - 1; i++) { for (j = 0; j < m - 1; j++)... |
#include <bits/stdc++.h> int f[2010][2010][2]; int n, m; int sr[2010][2010], sc[2010][2010]; int gr[2010], gc[2010]; int br[2010][2010], bc[2010][2010]; char s[2010][2010]; int main() { scanf( %d%d , &n, &m); for (int i = 1; i <= n; i++) scanf( %s , s[i] + 1); if (n == 1 && m == 1) return 0 * ... |
//-----------------------------------------------------------------------------
//
// (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
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.