text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int m, n, rowStart[1010], rowEnd[1010], colStart[1010], colEnd[1010], sum[1010][1010]; int startX = -1, startY; string a[1010]; void quit() { cout << -1 << endl; exit(0); } int getSum(int x, int y, int row, int col) { return sum[x][y] + sum[x... |
(****************************************************************************)
(* Copyright 2021 The Project Oak Authors *)
(* *)
(* Licensed under the Apache License, Version 2.0 (the "License") *)
(* 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... |
#include <bits/stdc++.h> using namespace std; const long long mod1 = 19260817; const long long mod2 = 19660813; int n; int m; char s[200005]; char opt[5]; struct { int tree[200005]; int lowbit(int x) { return x & -x; } void ins(int pos, int val) { for (; pos <= n; pos += lowbit(pos)) t... |
///////////////////////////////////////////////////////////////////////////////
//
// 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... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 13:43:21 09/16/2016
// Design Name:
// Module Name: Display
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
//... |
//****************************************************
// 6502 soft core project
// 8 bit ALU module
// Created March 14, 2005
// Author: Jim Patchell
//
// This code can be used for any purpose, except as
// a being used to turn in as a homework problem for
// school courses...note to teachers...your student
... |
/**
* 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 t; cin >> t; while (t--) { int n, m, rb, cb, rd, cd; int count = 0; cin >> n >> m >> rb >> cb >> rd >> cd; if (rb <= rd && cb <= cd) cout << min(rd - rb, cd - cb) << endl; else if (rb <= rd && cb > cd) ... |
//-------------------------------------------------------------------
//
// COPYRIGHT (C) 2011, VIPcore Group, Fudan University
//
// THIS FILE MAY NOT BE MODIFIED OR REDISTRIBUTED WI... |
#include <bits/stdc++.h> using namespace std; int main() { int mas[105] = {0}; int n; scanf( %d , &n); int res = -1; int resl = -1; for (int i = 0; i < n; i++) scanf( %d , &mas[i]); for (int i = 0; i < n; i++) { int len = 0; int mest = 0; for (int j = i; j < n; j++) {... |
#include <bits/stdc++.h> using namespace std; vector<int> graf[300007]; struct zap { long long zmiana; long long gle; }; vector<zap> z[300007]; int ojc[300007]; long long liczba[300007]; map<long long, long long> zmiany; void licz(int poz, int pop, long long zmiana, long long gl) { for (in... |
`timescale 1ns / 1ps
/*
* Spartan3AN_PicoBlaze_LCD.v
*
* ___ _ _ _ _ ___ _ _ ___
* | __._ _ _| |_ ___ _| |_| |___ _| | . | \ |_ _|
* | _>| ' ' | . / ._/ . / . / ._/ . | | || |
* |___|_|_|_|___\___\___\___\___\___|_|_|_\_||_|
*
*
* Created on : 20/07/2015
* Author : Ernesto And... |
#include <bits/stdc++.h> using namespace std; int a[100000]; int b[100000]; bool judge(long long x, int n, long long k) { for (int i = 0; i < n; ++i) { k -= max(0LL, a[i] * x - b[i]); if (k < 0) { return false; } } return true; } int main(void) { int n, k; asser... |
#include <bits/stdc++.h> using namespace std; int N; long long shu[200010]; int main() { while (scanf( %d , &N) != EOF) { for (int i = 1; i <= N * 2; i++) { scanf( %I64d , &shu[i]); } sort(shu + 1, shu + 1 + 2 * N); long long ans = (shu[N] - shu[1]) * (shu[2 * N] - shu[N + 1]... |
#include <bits/stdc++.h> using namespace std; map<int, vector<int> > m; int main() { int n, k, query; scanf( %d %d , &n, &k); for (int i = 0; i < (int)(k); i++) { scanf( %d , &query); m[query - 1].push_back(i); } int ans = 0; std::vector<int>::iterator low; for (int i = 0; ... |
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.3 (win64) Build Wed Oct 4 19:58:22 MDT 2017
// Date : Fri Nov 17 16:06:27 2017
// Host : egk-pc running 64-bit major release (build... |
#include <bits/stdc++.h> long long gcd(long long a, long long b) { while (a && b) { if (a > b) a %= b; else b %= a; } return a + b; } long long lcm(long long a, long long b) { return (((a) / gcd(a, b))) * b; } int phi(int n) { int result = n; for (int i = 2; i * 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... |
/**
* 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
`define clkperiodby2 10
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 05/09/2015 12:23:19 PM
// Design Name:
// Module Name: tb_MMUI
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
//... |
/**
* 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 = 1e4 + 10; const int maxk = 2e4 + 10; const int inf = 0x3f3f3f3f; int n, m, k; bool g[maxn][maxn]; struct Block { int l, r, b, t; }; Block b[maxk]; int bnum; bool vis[maxk]; int d[maxk]; int res; int start, stop; void bfs() ... |
#include <bits/stdc++.h> using namespace std; const int N=2e5+7; int n; int x=-1,y=-1,z=-1; int a[N], t[N*4]; vector<int> suff(N), pref(N); void build(int v=1, int tl=1, int tr=n){ if(tl==tr) t[v]=a[tl]; else { int tm = (tl+tr)/ 2; build(v*2, t... |
/////////////////////////////////////////////////////////////////////
//// ////
//// WISHBONE rev.B2 compliant I2C Master byte-controller ////
//// ////
//// ... |
#include <bits/stdc++.h> using namespace std; const int inf = 1e9 + 333; const long long linf = 1e18 + inf; const int LEN = 6e5 + 5; int n, m, q, len; char str[LEN], s[LEN]; int a[LEN], st[LEN], nd[LEN], suf[LEN], ord[LEN], lcp[LEN], w[LEN], root[LEN], L[LEN], R[LEN]; pair<pair<int, int>, int> C[L... |
#include <bits/stdc++.h> using namespace std; int ucln(int a, int b) { int r; while (b > 0) { r = a % b; a = b; b = r; } return a; } int main() { int x, y, a, b, bc; cin >> x >> y >> a >> b; bc = x * y / ucln(x, y); int l = a, r = b; while (l % bc != 0) l++;... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int maxn = 1e5 + 50; const int inf = 1e8 + 10; int l[maxn], e[maxn]; int bs(int a[], int x, int n) { int l = 0, r = n; int m; while (l < r) { m = (l + r) / 2; if (a[m] >= x) r = m; else ... |
#include <bits/stdc++.h> using namespace std; int main() { int tt = 120; int test[6] = {0, 1, 3, 5, 2, 4}; int n = 5; int p[2001], s[2001]; int p_l[2001], s_l[2001]; int ans = 0; vector<pair<int, int> > v_ans; scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &p[i... |
// megafunction wizard: %LPM_MUX%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: LPM_MUX
// ============================================================
// File Name: counter_bus_mux.v
// Megafunction Name(s):
// LPM_MUX
//
// Simulation Library Files(s):
// lpm
// ========================================... |
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } bool isPrime(long long n) { long long c; if (n <= 1) return false; c = sqrt(n); for (int i = 2; i <= c; i++) if (n % i == 0) return false; return true; } int ... |
#include <bits/stdc++.h> using namespace std; int sum[705][705], a[500100]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int q, t, x, y; memset(sum, 0, sizeof(sum)); cin >> q; while (q--) { cin >> t >> x >> y; if (t == 1) { a[x] += y; ... |
#include <bits/stdc++.h> using namespace std; bool check(long n, long k) { long dem = 0; while (n > 0) { long x = n % 10; n /= 10; (x == 4 || x == 7) ? dem++ : dem = dem; } if (dem <= k) return 1; return 0; } int main() { long n, k, dem = 0; cin >> n >> k; long ... |
#include <bits/stdc++.h> using namespace std; const int inf = 1e9; const int maxn = 5555; int s[maxn]; int main(int argc, char const *argv[]) { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; for (int i = 1; i <= n; ++i) { int t; cin >> t; s[i] = s[i - 1] + t; ... |
#include <bits/stdc++.h> using namespace std; int main() { bool check = false; int left, right; cin >> left >> right; for (int i = left; i <= right; i++) { int num = i; bool ch[10] = {false}; while (num > 0) { if (ch[num % 10]) break; ch[num % 10] = true; nu... |
#include <bits/stdc++.h> using namespace std; const long long N = 1e5 + 100; const long long M = 21; const long long mod = 1e9 + 7; const long long MOD = 998244353; const long long P = 1336; const long double eps = 0.000000001; const long long inf = 1e16 + 7; mt19937 gen(chrono::high_resolution_clock:... |
#include <bits/stdc++.h> using namespace std; template <class A, class B> ostream &operator<<(ostream &out, const pair<A, B> &a) { return out << ( << a.first << , << a.second << ) ; } template <class A> ostream &operator<<(ostream &out, const vector<A> &a) { for (const A &it : a) out << it << ... |
#include <bits/stdc++.h> using namespace std; int i, n, mx, mn, p1, p2, poz, poz1, poz2, k, mx1, mx2, m, mij, u, x, y, z, q; struct para { int x, y, z, ind; } a[100007]; int cmp(para k1, para k2) { if (k1.x > k2.x) return 0; else if (k1.x == k2.x) { if (k1.y > k2.y) return 0; ... |
/*
Copyright 2010 David Fritz, Brian Gordon, Wira Mulia
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.
... |
#include <bits/stdc++.h> using namespace std; void solve() { int t; cin >> t; while (t--) { int n; cin >> n; int r, p, s; cin >> r >> p >> s; string q; cin >> q; int lastn = ceil(n / 2.0); int R = 0, P = 0, S = 0; for (long long i = 0; i < q.size(); ... |
// (C) 2001-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 simulation
// files), and any associated doc... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, m, i; cin >> n; long long int arr1[n]; for (i = 0; i < n; i++) cin >> arr1[i]; cin >> m; long long int arr2[m]; for (i = 0; i < m; i++) cin >> arr2[i]; sort(arr1, arr1 + n); sort(arr2, arr2 + m); cout... |
#include <bits/stdc++.h> using namespace std; void MAIN() { long long N; cin >> N; string S = to_string(N); reverse(S.begin(), S.end()); int sz = (int)S.size(); long long ans = -2; for (int i = 0; i < (1 << sz); i++) { int i_c = i; if ((i_c >> (sz - 1) & 1) || (i_c >> (sz - 2... |
#include <bits/stdc++.h> using namespace std; const int mx = 2e5 + 5; int dp[mx][3], arr[mx], n, h[mx]; void solve() { cin >> n; for (int i = 1; i <= n; i++) { cin >> arr[i]; h[arr[i]]++; } sort(arr, arr + n + 1); memset(dp, 0, sizeof dp); dp[1][0] = dp[1][1] = dp[1][2] = 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... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long t; cin >> t; while (t--) { long long n; cin >> n; vector<pair<long long, long long> > v(n); for (long long i = 0; i < n; i++) { cin >> v[i].first ... |
#include <bits/stdc++.h> using namespace std; int num[200000 + 5]; int main() { int i, j, k, n, m; cin >> n; long long sum = 0; for (i = 0; i < n; i++) { cin >> num[i]; sum += num[i]; } long long ans = 0; sum++; sum /= 2; for (i = 0; i < n; i++) { ans += num[i... |
#include <bits/stdc++.h> using namespace std; int res = INT_MAX; int i, j; int n, d; int a[2018]; int main() { cin >> n >> d; for (int x = 0; x < n; x++) cin >> a[x]; sort(a, a + n); for (i = 0; i < n; i++) for (j = n - 1; j >= i; j--) { if (a[j] - a[i] <= d) { res = ... |
#include <bits/stdc++.h> using namespace std; map<long long, long long> m; long long n, p; int main() { cin >> n; while (cin >> n) m[n]++; for (n = 1; n < 11; n++) p += m[n] * m[n * -1]; cout << p + m[0] * (m[0] - 1) / 2; } |
//======================================================================
//
// rosc.v
// ------
// Digital ring oscillator used as entropy source. Based on the
// idea of using carry chain in adders as inverter by Bernd Paysan.
//
//
//
// Author: Joachim Strombergson
// Copyright (c) 2014, Secworks Sweden AB
// All ri... |
#include <bits/stdc++.h> using namespace std; int a[100005], b[100005]; int main(void) { int n; stack<int> s; scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); } for (int i = n; i >= 1; i--) { if (s.empty()) { s.push(a[i]); b[i] = 0; co... |
#include <bits/stdc++.h> using namespace std; long long numbit(long long x) { return (1LL << x) - 1LL; } long long getbit(long long x, long long i) { return (x >> i) & 1LL; } long long onbit(long long x, long long i) { return x | (1LL << i); } long long offbit(long long x, long long i) { return x & (~(1LL << ... |
#include <bits/stdc++.h> #pragma comment(linker, /stack:200000000 ) #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; signed main() { long long int t; cin >> t; vector<long long int> nums = {6, 10, 14, 15}; long lo... |
#include <bits/stdc++.h> using namespace std; double a, b, c, d; int main() { char st = e ; cin >> a >> b >> c >> d; if (a / b == b / c && b / c == c / d) st = g ; if (a - b == b - c && b - c == c - d) st = a ; if (st == e ) cout << 42 << endl; else if (st == g ) { int d1 ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int width; int height; cin >> height; cin >> width; char art[height][width]; for (int i = 0; i < height; i++) { for (int k = 0; k < width; k++) { cin >> art[i][k]; } ... |
#include <bits/stdc++.h> using namespace std; char c; int n, m, cnt, f[3600][3]; bool a[60][60], flag, heng[51][51][51], shu[51][51][51]; bool go(int x1, int y1, int x2, int y2) { if (heng[x1][min(y1, y2)][max(y1, y2)] && shu[y2][min(x1, x2)][max(x1, x2)]) return true; if (heng[x2][min(y1, y2)][... |
/*
* 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; using ll = long long; const int N = 2e5 + 10; int beg[N]; int nxt[N]; int to[N]; int tot; int a[N]; void add(int x, int y) { ++tot; nxt[tot] = beg[x]; to[tot] = y; beg[x] = tot; } int main() { ios::sync_with_stdio(false); cin.ti... |
#include <bits/stdc++.h> using namespace std; const long long mod = 998244353; int solve(); void precomp(); int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); int t = 1; if (0) cin >> t; precomp(); for (int tc = 1; tc <= t; tc++) { if (0 && 0) cout << Case # << tc ... |
#include <bits/stdc++.h> using namespace std; mt19937 rng_32(chrono::steady_clock::now().time_since_epoch().count()); const int maxn = 2e5 + 10; const double pi = acos(-1); int main() { int cas; cin >> cas; double n; while (cas--) { cin >> n; printf( %.10lf n , cos(pi / 4.0 / n) / ... |
#include <bits/stdc++.h> int main() { int tux; scanf( %d , &tux); int foo = 0, bar = 0, baz = 0, quz = 1; for (int i = 0; i < tux; i++) { int pur; scanf( %d , &pur); foo += pur; bar++; if (foo * quz >= bar * baz) { baz = foo; quz = bar; } } p... |
#include <bits/stdc++.h> using namespace std; long long pw(long long a, long long b) { if (b == 0) return 1; if (b % 2 == 1) return (a * pw(a * a, b / 2)); else return (1 * pw(a * a, b / 2)); } void solve() { long long n, k; cin >> n >> k; long long a[n], b[k]; for (int i... |
//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; const int maxn = 105000; int a[maxn], ans[maxn]; int n, p, res1, res2; bool judge1(int k) { int sum = 0; for (int i = 1; i <= n; i++) { if (a[i] <= k) sum++; else { int tmp = a[i] - k; sum -= tmp; if (sum < 0) re... |
#include <bits/stdc++.h> #define debug(x) cerr << #x << = << x << endl using namespace std; typedef long long LL; const int N = 400005; int a[N], b[N], n; vector<int> vec; int main() { int T; scanf( %d , &T); while(T--) { vec.clear(); scanf( %d , &n); for... |
#include <bits/stdc++.h> using namespace std; int main() { int n, a; cin >> n; long long arr[n], sum[n], ans[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; sum[i] = arr[i]; if (i > 0) sum[i] += sum[i - 1]; } sort(arr, arr + n); for (int i = 0; i < n; i++) { ans[... |
#include <bits/stdc++.h> using namespace std; long long n, m, p; long long A[5001]; long long a[5001]; long long l[1000005]; long long dp[2][5001]; long long s[5001][5001]; void work(long long *prev, long long *nxt) { long long total = 0, prev_total = 1; for (int i = 1; i <= n; i++) { for ... |
//////////////////////////////////////////////////////////////////////////////////////////////
// File: delta_frame.v
// Author: B. Brown, T. Dotsikas
// About: Produces the delta frame using grayscale pixels from two different frames.
/////////////////////////////////////////////////////////////////////////////////... |
`timescale 1ns / 1ps
// Xilinx Single Port Write First RAM
// This code implements a parameterizable single-port write-first memory where when data
// is written to the memory, the output reflects the same data being written to the memory.
// If the output data is not needed during writes or the last read value is... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 100000 + 10; int mod; int n, m; vector<int> E[MAX_N]; bool v[MAX_N]; int cnt; void dfs(int u) { if (v[u]) return; v[u] = true; ++cnt; for (vector<int>::iterator e = E[u].begin(); e != E[u].end(); ++e) { dfs(*e); } ... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: scfifo
// ============================================================
// File Name: net2pci_dma_512x32.v
// Megafunction Name(s):
// scfifo
//
// Simulation Library Files(s):
// altera_mf
// ========================... |
// (c) NedoPC 2010
//
// wait generator for Z80
`include "../include/tune.v"
module zwait(
input wire rst_n,
input wire wait_start_gluclock,
input wire wait_start_comport,
input wire wait_end,
output reg [6:0] waits,
output wire wait_n,
output wire spiint_n
);
`ifdef SIMUL... |
//Jun.29.2004 w0,w1,w2,w3 bug fix
//Jun.30.2004 endian bug fix
//Jul.1.2004 endian bug fix
//Apr.2.2005 Change Port Address
`include "define.h"
`define COMB_MOUT
`define COMB_MOUT_IR
`define NO_SIGNED_MOUT
module ram_module_altera(clock,sync_reset,IR,MOUT,Paddr,Daddr,wren,datain,access_mode,M_signed,
uread_port,wri... |
#include <bits/stdc++.h> int main() { int n, i, sum1, sum2, sum3; scanf( %d , &n); sum1 = 0; for (i = 0; i < n; i++) { int a; scanf( %d , &a); sum1 ^= a; } sum2 = 0; for (i = 0; i < n - 1; i++) { int b; scanf( %d , &b); sum2 ^= b; } sum3 = 0; ... |
#include <bits/stdc++.h> using namespace std; template <typename T> T abs(T x) { return x > 0 ? x : -x; } template <typename T> T sqr(T x) { return x * x; } template <typename T> ostream &operator<<(ostream &s, const vector<T> &x) { s << [ ; for (auto it : x) { s << it ... |
#include <bits/stdc++.h> using namespace std; vector<int> g[5000]; vector<int> r[5000]; vector<int8_t> vis(5000); int n, m, s; void dfs(int src) { vis[src] = true; for (auto v : g[src]) { if (!vis[v]) { dfs(v); } } } int root(int src, vector<bool> &df) { df[src] = tru... |
#include <bits/stdc++.h> using namespace std; using ll = long long; #ifdef LOCAL #define debug(...) { std::cout << [ << __FUNCTION__ << : << __LINE__ << ] << #__VA_ARGS__ << << __VA_ARGS__ << std::endl; } #else #define debug(...) #endif const long long mod = 1000000007; ... |
/*
Copyright (c) 2016 Alex Forencich
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, modify, merge, publish, distribute,... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 10; int a[maxn], x[maxn], y[maxn], sk[maxn], top, cnt; int main() { int n, P, ly = -1, fl = 0; scanf( %d , &n), P = n; for (int i = 1; i <= n; i++) scanf( %d , a + i); for (int i = n; i >= 1; i--) { if (a[i] == 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... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; int m, v, m1, m2, v1, v2; cin >> a >> b >> c >> d; m1 = 3 * a / 10; m2 = a - (a / 250) * c; if (m1 > m2) m = m1; else m = m2; v1 = 3 * b / 10; v2 = b - (b / 250) * d; if (v1 > v2) v =... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 3e5 + 10; vector<pair<string, int> > ch[MAXN]; int nxt[MAXN][27], n, gp, ans; string t; void adds(string &tmp) { for (int i = 0; i < tmp.size(); i++) { gp = nxt[gp][tmp[i] - a ]; if (gp == t.size()) ans++; } } void dfs(i... |
//############################################################################
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// (C) Copyright
// All Right Reserved
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// 2015 DLAB Course
// 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 K = 30; const int MOD = 1e9 + 7; long long n, power[K + 1]; int k; __inline void add(int &a, int b) { if ((a += b) >= MOD) { a -= MOD; } } struct Matrix { int trans[K][K]; int go[K]; Matrix() { memset(trans, 0, sizeo... |
//////////////////////////////////////////////////////////////////////
//// ////
//// Generic 32x32 multiplier ////
//// ////
//// This file is part of the OpenR... |
// File gh_fifo_async16_sr.vhd translated with vhd2vl v2.4 VHDL to Verilog RTL translator
// vhd2vl settings:
// * Verilog Module Declaration Style: 1995
// vhd2vl is Free (libre) Software:
// Copyright (C) 2001 Vincenzo Liguori - Ocean Logic Pty Ltd
// http://www.ocean-logic.com
// Modifications Copyright (C... |
/*
* 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... |
//*****************************************************************************
// (c) Copyright 2008 - 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
/... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 13:54:33 12/16/2015
// Design Name:
// Module Name: uart_unload.v
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies: ... |
// megafunction wizard: %ROM: 1-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: wb_rom_32x8192.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 law... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 02/01/2016 11:47:41 AM
// Design Name:
// Module Name: FullAdder_WithErrorDetection
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dep... |
#include <bits/stdc++.h> using namespace std; long long t = 1; template <class myType> void print_arr(myType &arr, long long L, string sep) { for (long long(i) = (0); (i) < (L); ++(i)) { cout << arr[i]; if (i < L - 1) { cout << sep; } } cout << n ; return; } long ... |
#include <bits/stdc++.h> using namespace std; int n, m, T, fa[500005], top, st[500005 << 2], d[500005], a[500005]; struct E { int x, y, l, r; } e[500005]; int Getfa(int x) { while (fa[x] != x) x = fa[x]; return x; } int col(int x) { int now = 0; while (fa[x] != x) now ^= a[x], x = fa[x... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2004 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc; initial cyc=1;
reg [63:0] rf;
reg [63:0] rf2;
reg [63:0] biu;
reg ... |
#include <bits/stdc++.h> using namespace std; int n, m, l, r, ar[110], ubah; int main() { cin >> n >> m; for (int i = 1; i <= m; i++) { cin >> l >> r; ar[l]++; ar[r + 1]--; } for (int i = 1; i <= n; i++) { ubah += ar[i]; if (ubah != 1) { cout << i << << ub... |
/**
* 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.