text stringlengths 59 71.4k |
|---|
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2016/08/31 22:34:01
// Design Name:
// Module Name: autosm
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revisi... |
//////////////////////////////////////////////////////////////////////
//// ////
//// OR1200's Write-back Mux ////
//// ////
//// This file is part of the OpenR... |
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } int main() { int n, m, k; cin >> n >> m >> k; vector<pair<int, int> > v; for (int i = 0; i < n; i++) { int x; cin >> x; v.push_back(make_pair(x, i)); } sort(v.begin(), v.... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 13:46:20 11/08/2015
// Design Name: ALU
// Module Name: C:/Users/Juanjo/Documents/Juanjo/Facu/Arquitectura/Workspace Xilinx/ALUFinal/ALU_Test.v
// Project Name: ALUF... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; for (int i = n; i < 2 * n; ++i) cout << i << ; return 0; } |
#include <bits/stdc++.h> using namespace std; int a[2000][2000], k, p[2000], Index; void add(int x, int y) { a[x][y] = a[y][x] = 1; } int main() { scanf( %d , &k); int maxbit = 0; for (int i = (1); i <= (30); ++i) if ((1 << i) & k) maxbit = i; Index = 2; int cur = ++Index; add(1, c... |
#pragma GCC optimize(2) #include <bits/stdc++.h> #define all(n) (n).begin(), (n).end() #define se second #define fi first #define pb push_back #define mp make_pair #define sqr(n) (n) * (n) #define rep(i, a, b) for (int i = (a); i <= (b); ++i) #define per(i, a, b) for (int i = (a); i >= (b); --i) #de... |
// -- (c) Copyright 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 proper... |
/**
* 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) 1995/2018 Xilinx, Inc.
//
// 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
//
/... |
#include <bits/stdc++.h> using namespace std; signed main() { int64_t n; cin >> n; int64_t a[n]; for (int64_t i = 0; i < n; i++) cin >> a[i]; map<int64_t, int64_t> first; map<int64_t, int64_t> second; first[a[0]] = 1; int64_t sum = 0; for (int64_t i = 0; i < n; i++) sum += a[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 NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<
// ------------------------------------------------------------------
// Copyright (c) 2006-2011 by Lattice Semiconductor Corporation
// ALL RIGHTS RESERVED
// -------... |
#include <bits/stdc++.h> using namespace std; const int maxn = 500002; long long a[maxn]; int n, k, d; void enter() { cin >> n >> k >> d; for (int i = (1), _b = (n + 1); i < _b; ++i) cin >> a[i]; } int seg[4 * maxn]; void update(int l, int r, int st, int q) { if (l == r) seg[st] = 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 la... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int a[maxn]; set<int> S; long long qpow(long long a, long long b, long long mod) { long long ret = 1LL; while (b) { if (b & 1) ret = ret * a % mod; a = a * a % mod; b >>= 1; } return ret; } long long... |
// // (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 simul... |
#include <bits/stdc++.h> using namespace std; bool sortinrev(const pair<long long, long long> &a, const pair<long long, long long> &b) { return (a.first > b.first); } void solve() { long long n; cin >> n; long long a[n]; map<long long, long long> mp; for (long long i = 0... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:512000000 ) using namespace std; void solve(bool); void precalc(); clock_t start; int main() { start = clock(); int t = 1; cout.sync_with_stdio(0); cin.tie(0); precalc(); cout.precision(10); cout << fixed; int testNum =... |
/*
* 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... |
/* -------------------------------------------------------------------------------
* (C)2007 Robert Mullins
* Computer Architecture Group, Computer Laboratory
* University of Cambridge, UK.
* -------------------------------------------------------------------------------
*
* Logic to determine if the virtual-cha... |
//
// Copyright (C) 2015 Markus Hiienkari <>
//
// This file is part of Open Source Scan Converter project.
//
// 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... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int a = min(k, 26) + 97; vector<char> b; for (int i = 97; i < a; i++) { b.push_back((char)i); } string key = ; for (int i = 0; i < b.size(); i++) key += b[i]; int c = n - k, j = 0; whi... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n % 2 == 0) { if (n >= 8 && n % 4 == 0) cout << ((n / 4) - 1) << endl; else if (n > 4 && n < 8) cout << 1 << endl; else if (n <= 4) cout << 0 << endl; else cout << ... |
/*******************************************************************************
* This file is owned and controlled by Xilinx and must be used solely *
* for design, simulation, implementation and creation of design files *
* limited to Xilinx devices or technologies. Use with non-Xilinx ... |
#include <bits/stdc++.h> using namespace std; const int Max = 2e5 + 10; const int LOG = 30; const int INF = 1e9 + 10; struct Trie { int l[Max * LOG], r[Max * LOG]; int cnt[Max * LOG]; int sz = 1; int index[Max * LOG]; int dp[Max * LOG][2]; void insert(int x, int ind) { int p = 1;... |
#include <bits/stdc++.h> using namespace std; int N, K; int A, B; signed long long from[505]; signed long long to[505]; void solve() { int i, j, k, l, r, x, y; string s; cin >> N >> K; for (x = 0; x < (505); x++) for (y = 0; y < (505); y++) from[x] = -1LL << 60; from[0] = 0; in... |
#include <bits/stdc++.h> using namespace std; int x[111111]; int y[111111]; int main() { int i, n, m, t; long long xx = 0, yy = 0; scanf( %d , &n); for (i = 1; i <= n; i++) { scanf( %d , &t); x[t] = i; y[t] = n - i + 1; } scanf( %d , &m); for (i = 1; i <= m; i++) { ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:44:30 05/15/2014
// Design Name:
// Module Name: GameCtr
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depende... |
#include <bits/stdc++.h> using namespace std; unsigned long long int t, k, x; int main() { ios_base::sync_with_stdio(0); cin >> t; for (; t > 0; t--) { cin >> k >> x; cout << (k - 1) * 9 + x << endl; } } |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: ctu_mask_id.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/o... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2000 + 10; const int maxm = 4e5 + 10; const long long mod = 1e9 + 7; const int inf = 0x3f3f3f3f; const double eps = 1e-5; const double pi = acos(-1.0); int t; int n, a[maxn]; int cnt[maxn]; int main() { ios::sync_with_stdio(false);... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); long long q; long long m; cin >> q >> m; long long j = 0; vector<pair<long long, long long>> spells; spells.push_back({0, 0}); for (int i = 0; i < q; i++) { long long k,... |
#include <bits/stdc++.h> using namespace std; int T, pw[10000005], N, K, X, c[10000005], d[10000005]; long long exp(long long a, long long b) { if (b == 0) return 1; if (b == 1) return a; long long res = exp(a, b >> 1); if (b & 1) { return a * (res * res % 998244353) % 998244353; } r... |
#include <bits/stdc++.h> using namespace std; vector<vector<char>> grid; vector<pair<int, int>> wind; int n, m; int k; int t; int w; unordered_map<char, pair<int, int>> charToDir; vector<pair<int, int>> dirs({pair<int, int>(1, 0), pair<int, int>(-1, 0), pair<int, int>(0,... |
#include <bits/stdc++.h> const int MAXN = 1e9 + 7; const int INF = 1e9 + 7; const signed long long MOD = 1e9 + 7; using namespace std; bool comp1(signed long long a, signed long long b) { return (sin(a) < sin(b)); } signed long long binpow(signed long long a, signed long long b) { signed long long res =... |
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; cin >> s; long long n = s.length(); vector<long long> prefix(n + 1, 0); for (long long i = 1; i <= n; i++) { if (isupper(s[i - 1])) prefix[i] ... |
#include <bits/stdc++.h> static const int MOD = 1000000007; using ll = long long; using u32 = unsigned; using u64 = unsigned long long; using namespace std; template <class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208; template <u32 M = 1000000007> struct modint { u32 val; m... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; vector<int> v[100000]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; map<int, int> m; for (int i = 0; i < n; i++) { int a; cin >> a; for (int j = 2; j <= sqrt(a); j... |
// megafunction wizard: %In-System Sources and Probes%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsource_probe
// ============================================================
// File Name: hps_reset.v
// Megafunction Name(s):
// altsource_probe
//
// Simulation Library Files(s):
//
// ============... |
#include <bits/stdc++.h> using namespace std; const int N = 2005, M = N * N; int n, m; string s[N]; bool isvalid(int x, int y) { return 0 <= x && x < n && 0 <= y && y < m && s[x][y] == . ; } int id(int x, int y) { return x * N + y; } int par[M]; void init() { for (int i = 0; i < M; i++) par[i... |
//--------------------------------------------------------------------------------
// spi_receiver.v
//
// Copyright (C) 2006 Michael Poppitz
//
// 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 Fo... |
// file: clk_wiz_0.v
//
// (c) Copyright 2008 - 2015 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... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e6 + 10; const int MAXM = 4e6 + 10; const long long MOD = 1e9 + 7; const long long INF = 0x3f3f3f3f; const unsigned long long BASE = 233; const int base = 5; mt19937_64 mt(time(0)); char rubbish[110]; bool GETDATA; inline long long re... |
#include <bits/stdc++.h> using namespace std; int p[2 * 1000005]; int n; int input() { int i; scanf( %d , &n); for (i = 1; i <= n; i++) p[i] = i; return 0; } int solve() { int i, j, ii; int t1, t2; for (i = 2; i <= n; i++) { t1 = p[i - 1]; for (j = i + i - 1; j < n + ... |
/* ltcminer.v
*
* Copyright (c) 2013 kramble
* Parts copyright (c) 2011
*
* 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 versio... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; int n, m, f[N]; bool vis[2][N]; vector<int> edges[2][N]; void dfs0(int x) { if (vis[0][x]) return; vis[0][x] = 1; for (int to : edges[0][x]) { if (f[to] != 1) dfs0(to); } } void dfs1(int x) { if (vis[1][x]) r... |
/*
* Copyright (c) 2001 Stephan Boettcher <>
*
* 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)
*... |
#include <bits/stdc++.h> using namespace std; bool mysort(const pair<double, int> &a, const pair<double, int> &b) { if (a.first == b.first) return a.second < b.second; else return a.first > b.first; } int main() { int n, t1, t2, k, a, b, i; double h1, h2; vector<pair<double, int>... |
// /**
// * This Verilog HDL file is used for simulation and synthesis in
// * the chaining DMA design example. It could be used by the software
// * application (Root Port) to retrieve the DMA Performance counter values
// * and performs single DWORD read and write to the Endpoint memory by
// * bypassing the DMA... |
#include <bits/stdc++.h> using namespace std; int main() { int n, h; cin >> n >> h; vector<int> a(n, 0); copy(istream_iterator<int>(cin), istream_iterator<int>(), a.begin()); vector<int> a_orig = a; sort(a.begin(), a.end()); int max1 = a[n - 1] + a[n - 2]; int min1 = a[0] + a[1]; ... |
/*
* Titor - Priority Encoder - Determines which, if any, of the input signals get arbitration in fixed priority
* Copyright (C) 2012 Sean Ryan Moore
*
* 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 Fre... |
module hd_data_reader (
input clk,
input rst,
input enable,
output reg error,
input hd_read_from_host,
input [31:0] hd_data_from_host
);
//Registers/Wires
reg prev_enable;
wire posedge_enable;
reg [31:0] t... |
#include <bits/stdc++.h> #pragma GCC optimize( -O3 ) using namespace std; const long long N = 1e6 + 5; void pairsort(long long a[], long long b[], long long n) { pair<long long, long long> pairt[n]; for (long long i = 0; i < n; i++) { pairt[i].first = a[i]; pairt[i].second = b[i]; } ... |
#include <bits/stdc++.h> using namespace std; inline int next_samebit(int mask) { int lowbit = mask & -mask; int slack = lowbit + mask; return slack | (mask ^ slack) / lowbit / 4; } int n, a[16], ans[4][4], at, row[4], col[4], zig[3], tag[2]; const int mt[] = {1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1... |
#include <bits/stdc++.h> using namespace std; const long long inf = 1e9 + 113; const long long maxn = 5000 + 113; bool used[maxn]; int main() { srand(time(NULL)); ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vector<pair<pair<int, int>, int>> we; for (int i = 0;... |
module avr109rx (
input rst,
input clk,
output[7:0] rx_data,
output rx_avail,
input rxd,
input rx_enabled
);
parameter CLK_FREQUENCY = ;
parameter BAUD_RATE = 19200;
function integer log2;
input integer value;
begin
value = value-1;
for (log2=0; value>0; log2... |
#include <bits/stdc++.h> using namespace std; struct S { long long t, w; } s[300009]; bool comp(S a, S b) { return a.t > b.t; } int main() { int n; scanf( %d , &n); n--; long long c, tmp; scanf( %lld %lld , &c, &tmp); for (int i = 0; i < n; i++) { scanf( %lld %lld , &s[i].t, ... |
#include <bits/stdc++.h> using namespace std; const int INF = (1 << 29); const int INFF = 0x7fffffff; const long long LINF = (1ll << 60); const long long LINFF = 0x7fffffffffffffff; const long double PI = 3.14159265359; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); long long rnd(l... |
/**
* 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; int cnt = 0; void rec(vector<bool> mask, int i, int ops) { if (cnt == n) return; if (i == n) { for (int j = 0; j < n; j++) cout << char( ( + mask[j]); for (int j = 0; j < n; j++) { if (ops > 0) { cout << ) ; o... |
/**
* 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; const long long N = 1e6 + 5; void pairsort(long long a[], long long b[], long long n) { pair<long long, long long> pairt[n]; for (long long i = 0; i < n; i++) { pairt[i].first = a[i]; pairt[i].second = b[i]; } ... |
#include <bits/stdc++.h> using namespace std; const long long N = 4000010, oo = 1e9; long long x, y, c, n; bool ok(long long t) { long long ans = 2ll * t * (t + 1ll) - 4ll * t + 1l; if (t > x) { ans -= (t - x) * (t - x); } if (t > n - x + 1) { ans -= (t - n + x - 1) * (t - n + x - 1)... |
#include <bits/stdc++.h> typedef struct mk { int v; struct mk *next; } roy; roy *add(roy *head, int v) { roy *t = (roy *)malloc(sizeof(roy)); t->v = v; t->next = NULL; if (head == NULL) return t; t->next = head; return t; } long long n, a[300010], s[300030], u, v, count; roy ... |
/**
* 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 law... |
#include <bits/stdc++.h> using namespace std; const int N = 300005; using ll = long long; map<ll, int> dd; map<pair<int, int>, int> f; int n, pre[3][N]; ll a[3][N]; int dfs(int n, int m) { if (pre[1][n] == -1 && pre[2][m] == -1 && pre[0][min(n, m)] == -1) return 0; pair<int, int> p{n, m}; if... |
//*****************************************************************************
// (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
/... |
/**
* 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(false); cin.tie(0); cout.tie(0); long long i, j, k; int n; cin >> n; vector<long long> arr(n); long long sum = 0; for (i = 0; i < n; i++) { cin >> arr[i]; sum += arr[i]; } if (sum ... |
#include <bits/stdc++.h> using namespace std; int fact[100005]; bitset<100005> p; int cnt[100005]; int best[100005]; int arr[100005]; int bestFactor(int n) { if (fact[n] == 0) { return n; } int curFactor = fact[n]; int bestChildFactor = bestFactor(n / curFactor); if (best[curFact... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 7; string t[6] = { lios , liala , etr , etra , initis , inites }; bool mark[3]; int md = -1; int typ(string s) { for (int i = 0; i < 6; i++) if (t[i].size() <= s.size()) { bool flag = true; for (int j = 0; j < t... |
#include <bits/stdc++.h> using namespace std; long long int gcd(long long int a, long long int b) { return (!b) ? a : gcd(b, a % b); } int n, k; void solve() { cin >> n >> k; string s; cin >> s; vector<vector<int>> mvs; int mxs = 0; int cnt = 0; while (cnt <= n) { vector<... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, ans = 0; long long sum_a = 0, sum_b = 0; cin >> n; vector<int> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; sum_a += a[i]; } cin >> m; vector<int> b(m); for (int i = 0; i < m; ++i) { cin >>... |
#include <bits/stdc++.h> using namespace std; int n, a[200011], b[200011], q[200011][2], l, r; long long sum[2]; char s[200011]; int main() { scanf( %d , &n); for (int i = 1; i <= n; ++i) scanf( %d , a + i); scanf( %s , s + 1); for (int i = 1; i <= n; ++i) b[i] = (s[i] == L ? -1 : 1); so... |
// dpram_inf_be_1024x16.v
// 2015,
// inferrable two-port memory with byte-enables
module dpram_inf_be_1024x16 (
input wire clock,
input wire wren_a,
input wire [ 2-1:0] byteena_a,
input wire [ 10-1:0] address_a,
input wire [ 16-1:0] data_a,
output reg [ 16-1:0] q_a,
input wi... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; long long mod = 1e9 + 7; long long fpo(long long x, long long y); int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ; int t; cin >> t; while (t--) { int n; char s[1000]; cin >> n >> s; if (n > 2) { ... |
#include <bits/stdc++.h> using namespace std; int cp[1000010], n; int dfs(int first) { int second = 0; for (int i = 1;; i++) if ((1 << i) - 1 >= first) { return (1 << i) - 1 ^ first; } } int main() { scanf( %d , &n); for (int i = n; i >= 1; i--) if (!cp[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; const int maxn = 2e5 + 111; int N; long long A[maxn]; map<long long, long long> f; void rl(long long &x) { char ch = (getchar()); x = 0; while ((ch < 0 || ch > 9 )) ch = (getchar()); while (!(ch < 0 || ch > 9 )) x = x * 10 + ch - 0 , ch = ... |
#include <bits/stdc++.h> using namespace std; int n; vector<int> u[100005]; int d[100005]; int a[100005], b[100005], x[100005]; int p[18][100005]; int up[100005], down[100005]; void go(int i, int pr) { p[0][i] = pr; d[i] = d[pr] + 1; for (int j : u[i]) if (j != pr) { go(j, i); ... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 08:32:16 03/03/2016
// Design Name: register
// Module Name: G:/ceshi/lab4/test_for_register.v
// Project Name: lab4
// Target Device:
// Tool versions:... |
#include <bits/stdc++.h> using namespace std; inline long long read() { long long x = 0, f = 0; char ch = getchar(); for (; ch < 0 || ch > 9 ; ch = getchar()) f ^= (ch == - ); for (; ch >= 0 && ch <= 9 ; ch = getchar()) x = x * 10 + ch - 0 ; return f ? -x : x; } const long long maxn ... |
/*
* 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 = 200 * 1000 + 100; int n, m, p; int a[maxn]; int b[maxn]; map<int, int> numb; map<int, int> numa; vector<int> ans; int sum = 0; void add(int x) { int val = numa[x] + 1; numa[x] = val; if (numb[x] >= val) sum++; } void remo... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 7; int main() { int T; scanf( %d , &T); while (T--) { int l, r; scanf( %d%d , &l, &r); if (l * 2 > r) { printf( YES n ); } else { printf( NO n ); } } return 0; } |
#include <bits/stdc++.h> using namespace std; template <typename T> T abs(T a) { return a < 0 ? -a : a; } template <typename T> T sqr(T a) { return a * a; } const int INF = (int)1e9; const long double EPS = 1e-9; const long double PI = 3.1415926535897932384626433832795; const int N = 4; ... |
#include <bits/stdc++.h> int main() { int n; scanf( %d , &n); n& n - 1 ? printf( NO ) : printf( YES ); return 0; } |
#include <bits/stdc++.h> using namespace std; const int M = 105; const int MOD = 1e6 + 3; struct matrix { int val[M][M]; int n; matrix(int nn, int x = 0) { n = nn; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) if (i != j) val[i][j] = 0; e... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 100100; int ar[MAXN]; int N; int main() { int sum = 0; for (int i = 0; i < 6; ++i) { scanf( %d , ar + i); sum ^= ar[i]; } sort(ar, ar + 6); if (ar[0] != ar[3] && ar[1] != ar[4] && ar[2] != ar[5]) { printf( Ali... |
/**
* bsg_fpu_f2i.v
*
* @author Tommy Jung
*
* Parameterized float-to-int converter.
* It supports conversion to signed or unsigned int.
*
* If the input float is negative, and the target is unsigned int
* then the output is set to zero, and invalid flag is raised.
*
* If the input float is too big (... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n % 2 == 0) { cout << 4 << << n - 4 << endl; } if (n % 2 == 1) { cout << 9 << << n - 9 << endl; } } |
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y; cin >> n >> x >> y; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } if (x > y) { cout << n << endl; return 0; } int cnt = 0; for (int i = 0; i < n; i++) { if (a[i] <= x)... |
#include <bits/stdc++.h> using namespace std; template <typename _T> inline void _DBG(const char *s, _T x) { cerr << s << = << x << n ; } template <typename _T, typename... args> void _DBG(const char *s, _T x, args... a) { while (*s != , ) cerr << *s++; cerr << = << x << , ; _DBG... |
#include <bits/stdc++.h> using namespace std; inline long long read() { long long x = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == - ) f = -1; ch = getchar(); } while (isdigit(ch)) { x = (x << 1) + (x << 3) + ch - 0 ; ch = getchar(); } return ... |
#include <bits/stdc++.h> using std::vector; bool judge(int x) { for (int i = 0; i < 31; i++) { if (x == (1 << i) - 1) return true; } return false; } int get_hzero(int x) { int res = 0, pre = 0; for (int i = 0; i < 31; i++) { if (x & (1 << i)) res = pre; else ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 04/23/2016 11:26:28 AM
// Design Name:
// Module Name: Sgf_Multiplication
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.