text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; using LL = long long; const int N = 2e5 + 4; int n, m, p[N], idx[N]; LL v1[N], v2[N]; vector<int> vals[N]; struct BIT { int s[N]; void init() { memset(s, 0, sizeof(s)); } void add(int i, int v) { for (; i <= n; i += i & (-i)) s[i] += 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 INF = 1000000005; long long INFF = 1000000000000000005LL; int dirx[8] = {-1, 0, 0, 1, -1, -1, 1, 1}; int diry[8] = {0, 1, -1, 0, -1, 1, -1, 1}; double pi = 3.1415926536; int MOD = 1e9 + 7; long long power(long long x, long long n) { long long res = 1... |
#include <bits/stdc++.h> using namespace std; string itos(int x) { stringstream ss; ss << x; return ss.str(); } int n, m, d[300010], vis[300010]; pair<int, int> a[300010]; vector<int> e[300010], res; int dfs(int now) { if (vis[now]) return 0; vis[now] = 1; d[now] = (d[now] == 1); ... |
/*
Copyright (c) 2015-2018 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, distri... |
/**
* 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 + 7; const int inf = 0x3f3f3f3f; const int mod = 1e9 + 7; const double pi = acos(-1.0); const double G = 6.67430e-11; int n, q; set<int> p; multiset<int> d; void in(int x) { p.insert(x); if (p.size() == 1) return; auto po... |
//-----------------------------------------------------------------
// FPGA Audio Project SoC IP
// V0.1
// Ultra-Embedded.com
// Copyright 2011 - 2012
//
// Email:
//
// License: LGPL
//
// If you wo... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10:32:33 05/12/2015
// Design Name:
// Module Name: IF_ID
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependenc... |
//Legal Notice: (C)2011 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... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: iobdg_int_mondo_addr_dec.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 redistri... |
//////////////////////////////////////////////////////////////////////////////////
//
// Author : Praveen Kumar Pendyala
// Create Date : 05/27/13
// Modify Date : 16/01/14
// Module Name : mapping
// Project Name : PDL
// Target Devices : Xilinx Vertix 5, XUPV5 110T
// Tool versions : 13.2 ISE
//
// ... |
/* Author:- Neel_Patel */ #include <bits/stdc++.h> #define ff first #define ss second #define pb push_back #define all(c) (c).begin(),(c).end() #define vi vector<int> #define pii pair<int,int> #define pll pair<long long,long long> #define vll vector<long long> #define priq priority_queue #define... |
#include <bits/stdc++.h> using namespace std; int n, m, t; int main() { cin >> t; while (t--) { int s = 0, a; cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> a; s += 2 * a; } if (m < n || n < 3) { cout << -1 << endl; continue; } ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll inf = 1e18; template <typename T> void printvector(const vector<T>& foo) { for (auto el : foo) cout << el << ; cout << endl; } bool calc(vector<int>& permuration, const vector<vector<int>>& sets, vector<boo... |
#include <bits/stdc++.h> using namespace std; stringstream ss; long long p[1000010], h1[1000010], h2[1000010]; int main() { p[0] = 1; for (int i = 1; i < 1000010; i++) h1[i] = p[i] = p[i - 1] * 127LL; int n, m, a, b; cin >> n >> m; for (int i = 1; i <= m; i++) { cin >> a >> b; h1... |
/**
* 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 mod = 1e9 + 7; int w[1007]; int n, x; int d[107]; int N = 101; int mat[107][107]; void mNoz(int (&a)[107][107], int (&b)[107][107], int (&c)[107][107]) { long long res[107][107]; for (int i = 1; i <= N; ++i) for (int j = 1; j <= N; ++j) res... |
#include <bits/stdc++.h> using namespace std; int main() { int a = 0, b = 0, c = 0, d = 0, n, temp, dl; cin >> n; for (int i = 0; i <= n; i++) { if (i < n) { cin >> temp; } else { temp = max(a, d) + 1; } dl = temp - a; if (dl != 1 && dl != -1) { if (... |
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int main() { fastIO int t; cin>>t; while(t--) { int x,y; cin>>x>>y; if (x==y) cout<<x+y<< ... |
#include <bits/stdc++.h> using namespace std; long long t0, t1, t2, x1, x2; long long count(long long y1, long long y2) { return t1 * y1 + t2 * y2 - t0 * (y1 + y2); } int main() { cin >> t1 >> t2 >> x1 >> x2 >> t0; if (t1 == t2) { cout << x1 << << x2; return 0; } long long ... |
// 32-bit adder
// Using Carry Lookahead adders
module adder
(
input wire [31:0] op1,
input wire [31:0] op2,
input wire cin,
output wire [31:0] sum,
output wire carry,
output wire v_flag
);
wire[6:0] cout;
assi... |
/**
* 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 int logx = 30; const long long int N = 1e6 + 5; const long long int INF = 1e18 + 5; const long long int mod = 321555123; const double PI = 3.14159265358979323846; inline long long int mul(long long int a, long long int b) { return (a * 1ll ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 6, inf = 2e9 + 7; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int tc; cin >> tc; while (tc--) { int n, x, y, d; cin >> n >> x >> y >> d; if (x == y) cout << 0 n ; else if (abs(y - x) %... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline T read() { T x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = (x << 1) + (x << 3) + (ch ^ 48); ch = ... |
`include "scmem.vh"
`include "DC_define.v"
`include "logfunc.h"
module DC_1_tagbank #(parameter Width = 15, Size =256, Forward=0)
//tag 10+counter 2 bits [11:10]+states 3 bits[14:12] =>15
(
input clk
,input reset
,input req_valid
//r... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, k; int p; scanf( %I64d %I64d %d , &n, &k, &p); long long ndiv2 = n / 2; long long ndiv2minus1 = n / 2 - 1; long long nminusk = n - k; for (int i = 0; i < p; i++) { long long x; scanf( %I64d , &x); p... |
//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... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2005 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
//
// Example module to create problem.
//
// generate a 64 bit value with bits
// [HighMaskSel_Bot... |
#include <bits/stdc++.h> using namespace std; int main() { long int n; long long int a[100000]; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n - 1; i++) { cout << a[i] + a[i + 1] << ; } cout << a[n - 1]; return 0; } |
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e6 + 10; const long long int md = 1e9 + 7; long long int n, fac[MAXN], invf[MAXN]; inline long long int inv(long long int a, long long int b = 1e9 + 5ll) { long long int k = 1ll; while (b) { if (b & 1) k = (k * a) % md; a = (a... |
#include <bits/stdc++.h> using namespace std; const int maxn = 5006; const int mod = 1000000009; double x[maxn], y[maxn], z[maxn]; double d[maxn][maxn]; int n; double dis(double x1, double y1, double z1, double x2, double y2, double z2) { double dx = x1 - x2; double dy = y1 - y2; double dz = z... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Rose-Hulman Institute of Technology
// Engineer: Adam Michael
// Date: 10/1/2015
// Summary: A basic distributed RAM.
////////////////////////////////////////////////////////////////////////////////... |
/*
* Redistributions of any form whatsoever must retain and/or include the
* following acknowledgment, notices and disclaimer:
*
* This product includes software developed by Carnegie Mellon University.
*
* Copyright (c) 2004 by Babak Falsafi and James Hoe,
* Computer Architecture Lab at Carnegie Mellon (CALCM),... |
/*
* 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 N, K, A, B, Q, a[200001], TA[524288], TB[524288]; void P(int x) { int p = 1, l = 1, r = N; while (l < r) { int m = l + r >> 1; if (x <= m) r = m, p <<= 1; else l = m + 1, p = p << 1 | 1; } TA[p] = std::min(a[x], A); TB[p] = std::min(... |
#include <bits/stdc++.h> using namespace std; template <class T> T abs(T x) { return x > 0 ? x : -x; } int n; int m; int mask[500][500][17]; int x[500], y[500], X[500], Y[500]; double xx[500], yy[500], XX[500], YY[500]; double vect(double x1, double y8687969, double x2, double y2) { return x... |
#include <bits/stdc++.h> using namespace std; long long dx[] = {-1, 0, 1, 0}; long long dy[] = {0, 1, 0, -1}; long long spf[1]; void sieve() { long long i, j; for (i = 0; i < 1; i++) spf[i] = i; for (i = 4; i < 1; i += 2) spf[i] = 2; for (i = 3; i * i < 1; i++) { if (spf[i] == i) { ... |
#include <bits/stdc++.h> using namespace std; const int N = 16 + 5; string a[N], x, y; int n, m, M = -1; map<string, map<string, int> > mm; bool vis[N]; void dfs(int deep, int mod) { if (deep > n + 1) return; if (deep == n + 1) { int tot = 0, f = 1; for (int i = 1; i <= n; ++i) tot += ... |
#include <bits/stdc++.h> using namespace std; vector<int> v, w; int m; long long int f(int d, int target) { long long int timeSpent = 0; long long int totDone = 0; long long int koytaDone = 0; long long int lastSpent = 0; for (int i = 0; i < v.size(); i++) { if (v[i] <= d) { ti... |
/*
** -----------------------------------------------------------------------------**
** control_regs.v
**
** various control bits (what was a single control register before)
**
** Copyright (C) 2008 Elphel, Inc
**
** -----------------------------------------------------------------------------**
** This file is part ... |
#include <bits/stdc++.h> using namespace std; int main() { string a, b; int n; cin >> n; cin >> a >> b; int ans = 0; for (int i = 0; i < n - 1; i++) { if (a[i] != b[i]) { ans++; if (a[i + 1] != b[i + 1] && a[i] != a[i + 1]) { swap(a[i], a[i + 1]); } el... |
/*
Copyright (c) 2014-2018 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, distri... |
#include <bits/stdc++.h> using namespace std; int p[31111], dp[31111][800]; int main() { int i, j, n, d, u; scanf( %d%d , &n, &d); for (i = 0; i < n; i++) { scanf( %d , &u); p[u]++; } for (i = 0; i <= 30000; i++) { for (j = 0; j <= 650; j++) { dp[i][j] = -10000000; ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long int t; t = 1; for (long long int _ = 0; _ < t; _++) { long long int n, m, b, mod; cin >> n >> m >> b >> mod; vector<long long int> v(n + 1); for... |
/*
* Milkymist VJ SoC
* Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
*
* 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, version 3 of the License.
*
* This program is distri... |
#include <bits/stdc++.h> using namespace std; const int N = 1000010; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } int lcm(int a, int b) { return a * b / gcd(a, b); } int main(void) { int c, d, n, m, k, i, j, ans = 10000; scanf( %d %d %d %d %d , &c, &d, &n, &m, &k); for (i = 0; i <= 1000... |
#include <bits/stdc++.h> using namespace std; const long long maxN = 1e6 + 5; const long long inf = 1e10; const long long mod = 1e9 + 7; long long n; long long ans = 1; long long res[maxN]; void normalSieve(long long n) { for (long long i = 1; i <= n; i++) res[i] = 1; for (long long i = 2; i * i... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> b[5001]; for (int i = 0; i < n; i++) { string s; int a, b1, c; cin >> s >> a >> b1; if (s[0] == M ) c = 0; else c = 1; b[i].push_back(c); b[i].push_back(... |
#include <bits/stdc++.h> using namespace std; using ll = long long; class SegmentTree { private: vector<ll> aint; vector<ll> lazy; public: SegmentTree(int n) { aint.resize(1 + 4 * n); lazy.resize(1 + 4 * n); } void cleannode(int node, int from, int to) { int mid = (f... |
#include <bits/stdc++.h> const int N = 120000; using namespace std; vector<string> fig; int n, m; vector<vector<string> > figs; int ans; vector<pair<pair<int, int>, int> > avec; int board[200][200]; bool bad(int a, int b) { return (a < 0 || a >= n || b < 0 || b >= m || board[a][b] == 1); } vec... |
#include <bits/stdc++.h> using namespace std; int main() { int a[26][26] = {0}, n, mini = -1; cin >> n; while (n--) { char c[11]; scanf( %s , c); int k = strlen(c), i = c[0] - a , j = c[k - 1] - a ; for (int m = 0; m < 26; m++) if (a[m][i]) a[m][j] = max(a[m][j], a[m][i... |
// pr1755593
module main;
wire out;
reg [4:0] data;
reg [2:0] sel;
test U1(out, data[0], data[1], data[2], data[3], sel[0], sel[1]);
initial begin
for (sel=0 ; sel<4 ; sel=sel+1)
for (data=0 ; data<16 ; data=data+1) begin
#1 if (out !== data[sel]) begin
$display("FAILED -- data=%... |
#include <bits/stdc++.h> using namespace std; int main(int argc, char *argv[]) { long long n, k, a[55]; cin >> n >> k; for (int i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + 1 + n); if (k > n) cout << -1 << endl; else { cout << a[n + 1 - k] << << a[n + 1 - k] << endl; ... |
#include <bits/stdc++.h> using namespace std; long long n, s, l, r, res, cur, maxx = -9999999999; int main() { cin >> n >> s; for (long long i = 1; i <= n; i++) { cin >> l >> r; maxx = max(maxx, l + r); } cout << max(maxx, s); return 0; } |
//Legal Notice: (C)2020 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 MAX = 100005; const int oo = 1e9 + 7; const long long mod = 1e9 + 7; const double eps = 1e-11; long long n; int main() { cin.sync_with_stdio(false); cin.tie(0); cin >> n; cout << (n - 2LL) * (n - 2LL) << endl; } |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 13:38:51 05/09/2016
// Design Name:
// Module Name: negexp
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// ... |
#include <bits/stdc++.h> using namespace std; int main() { int w, h, k; cin >> w >> h >> k; int s = 0; w -= 2; for (int i = 0; i < k; i++) { s += (w + h) * 2; w -= 4; h -= 4; } cout << s; } |
#include <bits/stdc++.h> using namespace std; int main() { char ch1, ch2, ch; int i, j, k, tc, res, total, temp, mx, num, num1, num2; int n, a, b; { scanf( %d %d %d , &n, &a, &b); if (b == 0) printf( %d n , a); else if (b > 0) { while (b--) { if (a == n) ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 1; int n, m, q, p[N], dis[N], far, cur, sz[N]; vector<int> g[N]; unordered_map<int, double> dp[N]; vector<pair<int, long long>> v[N]; int get(int u) { return p[u] == u ? u : p[u] = get(p[u]); } void dfs(int u, int p, int depth) { dis[... |
/*
* 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 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.
... |
/**
* 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:102400000,102400000 ) const int maxn = 1e5 + 300; const int INF = 0x3f3f3f3f; int main() { int k; scanf( %d , &k); if (k == 1) { puts( YES n2 1 n1 2 ); } else if (k % 2 == 0) { puts( NO ); } else { ... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-11; int vex[4] = {1, 0, -1, 0}; int vey[4] = {0, 1, 0, -1}; long long int MOD = 1000000007; const int MAX = 3000000; string c[100005]; char s[MAX]; int main() { int n; cin >> n; using p = pair<int, pair<int, int>>; usi... |
#include <bits/stdc++.h> using namespace std; long parent[100]; long nm[100]; vector<long> v[100]; long pp(long z) { if (parent[z] == z) { return z; } else { parent[z] = pp(parent[z]); } } int main() { long i, j, k, l, m, n, p, two, one; scanf( %ld%ld , &n, &m); for (i ... |
/**
* bsg_lru_pseudo_tree_backup.v
*
* tree pseudo LRU backup finder.
*
* Given the bit vector of disabled ways, it will tell
* you bit-mask and data to modify the original LRU bits to obtain
* the backup LRU.
*
* The algorithm to find backup_LRU is:
* start from the root of the LRU... |
#include <bits/stdc++.h> int any_table[11][11]; struct DammedPascalNUmber { int tb[13][13]; DammedPascalNUmber() { int i, j; for (i = 0; i <= 12; i++) for (j = 0; j <= i; j++) { int &r = tb[i][j]; if (j == 0 || i == 0) r = 1; else r =... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 03/17/2016 05:20:59 PM
// Design Name:
// Module Name: Priority_Codec_64
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Rev... |
/**
* 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 N = 2020, mod = 1000000007; int n, m, t = 0, a[N] = {}, vis[N] = {}; int *f[N] = {}, *g, *h, arr[N][N << 2] = {}; vector<int> e[N]; long long ans = 0; int main() { cin >> n >> m; for (int i = 1, u, v; i <= m; ++i) { cin >> u >> 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 law... |
#include <bits/stdc++.h> using namespace std; const int maxn = 210; int n, m, ans[maxn]; string s[maxn]; int solve(string s) { for (int i = 10; i >= 0; i--) { bool flag = 0; for (int j = 0; j < (1 << i); j++) { string t; for (int k = 0; k < i; k++) if (j & (1 << k)) ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, i, o = 0; cin >> n; long long int a[n]; for (i = 0; i < n; ++i) { cin >> a[i]; if (a[i] & 1) o++; } cout << min(o, n - 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> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n; cin >> n; long long x, a, b, i, f = 1, pa, push_back; vector<pair<long long, long long> > v(n); vector<long long> ch; cin >> x; cin >> a >> b; pa ... |
#include <bits/stdc++.h> using namespace std; int n, m, k, c, x, y, rem; char a[501][501]; int v[501][501]; void dfs(int x, int y) { if (rem == 0 || a[x][y] == # ) return; if (x < 0 || x >= n || y < 0 || y >= m || v[x][y] == 1) return; v[x][y] = 1; rem--; dfs(x + 1, y); dfs(x, y + 1);... |
#include <bits/stdc++.h> const int N = 1e6 + 5; const int mod = 1e9 + 7; const int MOD = mod - 1; const double eps = 1e-18; const double PI = acos(-1.0); using namespace std; char s[200]; int main() { int n, m; scanf( %d , &n), scanf( %d , &m); scanf( %s , s + 1); int l = strlen(s + 1); ... |
#include <bits/stdc++.h> using namespace std; int n, k, sum1, sum2; string a; int f[300011]; void solve() { scanf( %d%d , &n, &k); cin >> a; memset(f, -1, sizeof(f)); for (int i = 0; i < n; i++) { if (a[i] != ? ) { if (f[i % k] == -1) f[i % k] = a[i] - 0 ; els... |
#include <bits/stdc++.h> int main() { int x; scanf( %d , &x); if (x == 3) printf( 5 n ); else { for (int i = 1; i <= 100; i += 2) { if (i * i - (i * i) / 2 >= x) { printf( %d n , i); break; } } } } |
#include <bits/stdc++.h> using namespace std; int main() { string n; cin >> n; reverse(n.begin(), n.end()); int k = n[0] + 10 * n[1]; if (k % 4 == 0) { cout << 4 << endl; } else { cout << 0 << endl; } } |
/*
* 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... |
/*
* This file is part of the DSLogic-hdl project.
*
* Copyright (C) 2014 DreamSourceLab <>
*
* 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 2 of the License, or
... |
// final sub module for text
module check_text
(
input wire clk,
input wire [9:0] pix_x, pix_y,
output wire [3:0] check_on,
output reg [2:0] check_rgb
// we output text_rgb only because we have to select it according to FSM
);
// signal declaration
wire [10:0] rom_addr;
reg [6:0] ch... |
// Copyright 1986-2018 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2018.2 (win64) Build Thu Jun 14 20:03:12 MDT 2018
// Date : Sun Sep 22 03:32:37 2019
// Host : varun-laptop running 64-bit Service Pac... |
/*
* 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... |
/******************************************************************************/
/* LCD Controller monotone-RK 2014.12.01 */
/******************************************************************************/
`default_nettype none
`include "define.v"
module LCDCON #(parameter ... |
#include <bits/stdc++.h> using namespace std; const int N = 10005; const int P = 998244353; struct edge { int u, v, len; inline edge() {} inline edge(int _u, int _v, int _len) { u = _u; v = _v; len = _len; } } a[N], Q[N], res[N]; struct node { int l, r; vector<int> ... |
#include <bits/stdc++.h> using namespace std; vector<pair<long long, int> > H[1000007]; long long n, val[1000005], ans, cnt[1000005]; int S[1000005]; int m, up[1000005], p[1000005], len, b[1000005], mp[1000005]; void prepare() { int i, j; b[1] = 1; for (i = 2; i < 1000005; i++) { if (!b[i]... |
#include <bits/stdc++.h> using namespace std; int SET(int n, int pos) { return n = n | (1 << pos); } int RESET(int n, int pos) { return n = n & ~(1 << pos); } int CHECK(int n, int pos) { return (bool)(n & (1 << pos)); } int str2int(string s) { stringstream ss(s); int x; ss >> x; return x; } ... |
#include <bits/stdc++.h> using namespace std; int n, maxim, a; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> a; if (a > maxim) maxim = a; } cout << (maxim ^ a); return 0; } |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of inst_2_e
//
// Generated
// by: wig
// on: Mon Jun 26 08:25:04 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../../generic.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
// $Auth... |
/**
* 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; using i64 = long long; using f64 = double; using f80 = long double; using pii = pair<int, int>; using pll = pair<i64, i64>; using ptx = pair<f64, f64>; const int N = 3e5 + 5, LG = 20; int f[N], conv[N], tmp[N]; int main() { ios::sync_with_stdio(false... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 23:31:50 03/07/2016
// Design Name: mult4
// Module Name: C:/XilinxP/Practica1/mult4_test.v
// Project Name: Practica1
// Target Device:
// Tool version... |
#include <bits/stdc++.h> using namespace std; struct node; typedef node *Node; const int inf = 1000000; bool fl = 0; struct node { Node left, right, link, parent; int size, prior, sum, number; set<int> all; pair<int, int> mmin; node(int number) : number(number) { left = right = lin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.