text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int t; cin >> t; while (t--) { int n; cin >> n; int sze = n * 2; int arr[sze]; for (int i = 0; i < sze; i++) cin >> arr[i]; sort(arr, arr + sze); cout << arr[n] - ar... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 6; const int T = (1 << 21) + 123; long long a[T], b[T], s[T]; int p[N]; int n, m, d; int i, j, k, l; void upd(int i, int j, long long A, long long B, int l = 0, int r = d - 1, int q = 1) { if (!(i <= j && l <= r && l <= i &... |
// (C) 2001-2017 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated ... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved.
//
// In this HDL repository, there are many different and unique modules, consisting
// of... |
/**
* 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 gcd(int a, int b) { if (b == 0) { return a; } return gcd(b, a % b); } int findGCD(int arr[], int n) { int result = arr[0]; for (int i = 1; i < n; i++) { result = gcd(arr[i], result); } return result; } void swap(int* a... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); string a, c; int b, d, p; int pos[110]; p = 0; cin >> b >> d; cin >> a; cin >> c; int t = 0, la, lc; la = a.length(); lc = c.length(); int k = 0; for (int i = 0; i < lc; i++) ... |
//-----------------------------------------------------------------------------
//
// (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
... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2015.4
// Copyright (C) 2015 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1ns/1ps
modul... |
/*
* 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> #pragma GCC optimize( Ofast,unroll-loops ) #pragma GCC target( avx,avx2,fma ) using namespace std; template <typename T> using vc = vector<T>; template <typename T> using uset = unordered_set<T>; template <typename A, typename B> using umap = unordered_map<A, B>; template <t... |
/**
* 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 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
// -- laws.
// --
// -- DISCLAIMER
// -- This disclaimer is not a... |
#include <bits/stdc++.h> using namespace std; void solve() {} int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long ans = 0; long long l = max(c, a + b); long long r = c + d + 1; for (long long i = l; i < r; i++) { long long che = min(i - c, d - c + 1); long lon... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 13:55:30 03/10/2014
// Design Name:
// Module Name: Frequency
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
... |
/*
* 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... |
/*
* CRC module eth_crc_8 (see license below)
*
* CRC width: 32
* Data width: 8
* CRC polynomial: 32'h4c11db7
* Configuration: galois
* Bit-reverse: input and output
*
* x^32 + x^26 + x^23 + x^22 + x^16 + x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1
*
* Generated by https://github.co... |
/**
* 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 n, m; int a[200010], b[200010], fail[200010]; int main() { scanf( %d %d , &m, &n); --n; --m; int x, y; scanf( %d , &x); for (int i = 0; i < m; ++i) { scanf( %d , &y); b[i] = y - x; x = y; } scanf( %d , &x); for (int i = 0; i < n; +... |
#include <bits/stdc++.h> using namespace std; const int N = 5005; const int inf = 1000000005; int n, m, r[N][N]; char str[N][N]; int main() { scanf( %d %d , &n, &m); for (int i = 1; i <= n; i++) { scanf( %s , str[i] + 1); } for (int i = 1; i <= n; i++) { for (int j = m; j >= 1; j... |
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017
// Date : Wed Sep 20 21:11:18 2017
// Host : EffulgentTome running 64-bit major rele... |
#include <bits/stdc++.h> using namespace std; int a[1000]; bool b[1000][1000]; int main() { int N, M; scanf( %d%d , &N, &M); for (int i = 0; i < N; i++) scanf( %d , &a[i]); for (int i = 0; i < M; i++) { int x, y; scanf( %d%d , &x, &y); --x; --y; b[x][y] = true; ... |
#include <bits/stdc++.h> using namespace std; long long a, b, t, z; bool dfs(long long x, long long y) { if (x < y) swap(x, y); if (!y) return 0; if (!dfs(y, x % y)) return 1; z = x / y; if (y & 1) return (z & 1) ^ 1; return z % (y + 1) & 1 ^ 1; } signed main() { scanf( %lld , &t);... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC target( sse4 ) using namespace std; template <class c> struct rge { c b, e; }; template <class c> rge<c> range(c i, c j) { return rge<c>{i, j}; } template <class c> auto dud(c* x) -> decltype(cerr << *x, 0); template <class ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Tecnológico de Costa Rica
// Engineer: Juan José Rojas Salazar
//
// Create Date: 30.07.2016 10:22:05
// Design Name:
// Module Name: Mux_Array
// Project Name:
// Target Devices:
// Tool versions:
... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, m, k; cin >> n >> m >> k; long long int b[n]; memset(b, 0, sizeof(b)); vector<pair<long long int, long long int> > a; for (int i = 0; i < n; i++) { long long int x; cin >> x; a.push_back(make_pair(x... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e6 + 10; const int mod = 1e9 + 7; const int AL = 9; const int N = 5000; const int INF = 1e9; struct Trie { int net[10000][12], fail[10000]; bool end[10000]; int root, L; int newnode() { for (int i = 0; i < AL; ++i) net[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 law... |
//-----------------------------------------------------------------------------
// Title : KPU main test bench file
// Project : KPU
//-----------------------------------------------------------------------------
// File : kpu_soc.v
// Author : acorallo <>
// Created : 17.12.2016
//... |
#include <bits/stdc++.h> using namespace std; const int ALPHA = 26 + 1; struct Trie { Trie() { nodes.resize(2); } struct Node { Node() { memset(next, 0, sizeof(next)); } int next[ALPHA]; int finish = -1; }; int alloc() { nodes.push_back(Node()); return nodes.size() - ... |
#include <bits/stdc++.h> using namespace std; int n, m, Q; double sy, l[200100], r[200100], sum[200100], zl, zr, x, y, ans; struct Node { double x, y; } bj[2][200100], tmp, L, R; inline bool lef(Node u, Node v, Node w) { if (u.x == v.x) return w.x < u.x; double t; t = v.x - (v.x - u.x) * (v.... |
#include <bits/stdc++.h> using namespace std; vector<int> neigh[200009]; int ans[200009]; int a[200009]; int b[200009]; int c[200009]; int f[200009]; int Q[200009]; int L, R; int main() { int n, m; scanf( %d %d , &n, &m); for (int i = 0; i < m; i++) { scanf( %d %d %d , &a[i], &b[i]... |
//Com2DocHDL
/*
:Project
FPGA-Imaging-Library
:Design
MeanFilter
:Function
Local filter - Mean filter, it always used for smoothing images.
It will give the first output after sum_stage + 1 cycles while the input enable.
:Module
Main module
:Version
1.0
:Modified
2015-05-20
Copyright (C) 2015 Tianyu Dai (dtysky... |
/*
--------------------------------------------------------------------------
Pegasus - Copyright (C) 2012 Gregory Matthew James.
This file is part of Pegasus.
Pegasus is free; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k = 100000000, t; cin >> n; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 1; i < n; i++) { t = max(a[i - 1], a[i]); k = min(t, k); } cout << min(min(a[0], a[n - 1]), k); return 0; } |
#include <bits/stdc++.h> using namespace std; long long a00, a01, a10, a11; char *s; bool isSquare(long long x, long long &res) { long long t = sqrt(x); for (long long i = max(t - 10, 1LL); i <= t + 10; i++) { if (i * i == x) { res = i; return true; } } return false; ... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, i; cin >> n; for (i = 3; n / i >= 1; i = i * 3) if (n % i != 0) break; cout << n / i + 1; return 0; } |
#include <bits/stdc++.h> using namespace std; const int N = 1010; int n, m; char str[N][N]; int use[N]; int ans[N], tot; int Ncnt, root; struct Node { vector<int> ch; int color; int leaf; int kind; Node(void){}; } tree[N * N * 2]; void fail() { puts( NO ); exit(0); } ... |
// soft_tbm_queue.v
`timescale 1 ns / 1 ps
module soft_tbm_queue
#(parameter DATA_WIDTH=36)
(
input clk,
input sync,
input reset,
input write,
input read,
input clear,
input clear_token,
output empty,
output full,
output [3:0]size,
input [DATA_WIDTH:0]din,
output [DATA_WIDTH:0]dout
);
wire write_int... |
#include <bits/stdc++.h> using namespace std; const double eps = 0.000000001; double x[200000]; int n; void solve() { if (abs(x[1]) < eps) { int p = 0; for (int i = 1; i < n; i++) if (abs(x[i]) > eps) p++; if (p == 0) { printf( 1 n ); exit(0); } return... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, dp[105], a, b; memset(dp, 0, sizeof dp); cin >> n; for (int i = 1; i < n; ++i) { cin >> dp[i]; dp[i] += dp[i - 1]; } cin >> a >> b; cout << dp[b - 1] - dp[a... |
#include <bits/stdc++.h> using namespace std; int pr(int n) { for (int i = 2; i * i <= n; i++) if (n % i == 0) return 0; return 1; } int near(int n) { int i = 0; for (i = n - 2; i >= 2; i--) { if (pr(i)) break; } return i; } int main() { int i, n, s1, j = 0, s2 = 0, c... |
#include <iostream> #include <algorithm> #include <string> using namespace std; int main() { int t, n; string s, b = trygub ; cin >> t; while (t--) { int k = 0; cin >> n >> s; sort(s.begin(), s.end()); cout << s << endl; } } |
module i2s_tx #(parameter DATA_WIDTH = 16
) (clk, left_chan, right_chan, sdata, lrclk, mck, sck);
input wire clk; //general clock of project (top level) 50 MHz
input wire [DATA_WIDTH-1:0] left_chan;
input wire [DATA_WIDTH-1:0] right_chan;
output reg sdata; initial sdata <= 1'b0;
//output reg mck; initial mck <= ... |
// Accellera Standard V2.3 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2008. All rights reserved.
`ifdef OVL_XCHECK_OFF
//Do nothing
`else
`ifdef OVL_IMPLICIT_XCHECK_OFF
//Do nothing
`else
wire valid_test_expr;
assign valid_test_expr = ~((^test_expr) ^ (^test_expr));
`endif // OVL_... |
/*
* 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 ans; int main() { int d, n, u, i, prev; cin >> d >> n; for (i = 0; i < n; i++) { cin >> u; if (i and prev != 1) ans += d - prev + 1; prev = u + 1; if (prev > d) prev -= d; } cout << ans; 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... |
#include <bits/stdc++.h> using namespace std; int n, mem[100004][28]; char x, y; string s; map<pair<int, int>, int> m; int dp(int i = 0, int j = 27) { if (i == (int)s.size()) return 0; int& ret = mem[i][j]; if (~ret) return ret; if (m[{(int)(s[i] - a ), j}] != 1) { return ret = max(dp... |
/*
# heartbeat.v - Simple heartbeat module - not necessary for the UART
# but nice to know the config is loaded properly :)
#
# Copyright (C) 2014 Binary Logic (nhi.phan.logic at gmail.com).
#
# This file is part of the Virtual JTAG UART toolkit
#
# Virtual UART is free software: you can redistribute i... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int nn = 1; for (int i = 1; i < n; i++) { int c = 0; for (int j = 0; (1 << j) <= nn; j++) c++; nn += c; } vector<int> P; for (int i = 0; i < nn; i++) { bool f = false; for (i... |
#include <bits/stdc++.h> using namespace std; const int MOD = 10000; struct Big { vector<int> *data; int size() const { return data->size(); } bool operator<(const Big &a) const { if (size() != a.size()) return size() < a.size(); for (int i = (int)size() - 1; i >= 0; i--) if ((*dat... |
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1.0); const long long INF = 1e9; const long long LINF = INF * INF; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int N = 1 << 19; int n, k; vector<pair<long long, long long>> g[N]; long long dp[N][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 la... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k, res = 0; cin >> n >> k; vector<int> arrAB; vector<int> arrA; vector<int> arrB; for (int i = 0; i < n; i++) { int time, a, b; cin >> time >> a >> b; if (a == 1 && b == 1) { arrAB.push_back(time); ... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: bw_io_dtl_vref.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 an... |
#include <bits/stdc++.h> using namespace std; int n, a[100009]; int main() { cin >> n; if (n == 1) cout << 1; else if ((n / 2) % 2 == 1) cout << -1; else { for (int i = 1; i <= (n / 2 / 2); i++) { a[i * 2 - 1] = i * 2; a[i * 2] = n - (i - 1) * 2; a[n - i *... |
// DEFINES
`define BITS0 9 // Bit width of the operands
`define BITS1 8 // Bit width of the operands
`define BITS2 18 // Bit width of the operands
`define BITS3 36 // Bit width of the operands
// sees if the softaware matches simple primitives
module bm_match4_str_arch(clock,
reset... |
#include <bits/stdc++.h> using namespace std; int main(int argc, char *argv[]) { string s; int min1 = 200, min2 = 200, min3 = 200, min4 = 200, min5 = 200; cin >> s; for (int i = 0; i < s.size(); i++) { if (s[i] == h && i < min1) min1 = i; if (s[i] == e && i < min2 && min1 < i) min2 =... |
module fpga_top(
input clk,
input [fpga_height*fpga_width*wire_width*12-1:0] brbselect,
input [(fpga_height-1)*(fpga_width-1)*(wire_width*wire_width*12)-1:0] bsbselect,
input [fpga_width*fpga_height*lb_cfg_size-1:0] lbselect,
input [fpga_height*2*wire_width-1:0] leftioselect,
input [fpga_height*2*wire_width-1:0] ... |
#include <bits/stdc++.h> using namespace std; int n; struct Node { int u, w, next; }; struct Node node[300010]; int p; int f[100010], g[100010], num[100010], isgo[100010]; int judge(int n) { while (n) { if (n % 10 != 4 && n % 10 != 7) return 0; n /= 10; } return 1; } void... |
//////////////////////////////////////////////////////////////////////
//// ////
//// eth_crc.v ////
//// ////
//// This file is part of the Ether... |
/**
* 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... |
//---------------------------------------------------------------------------
// Testbench
//---------------------------------------------------------------------------
//
//***************************************************************************
// DISCLAIMER OF LIABILITY
//
// This file contains proprieta... |
#include <bits/stdc++.h> using namespace std; int tmp; string s; char a[3][10] = {{ q , w , e , r , t , y , u , i , o , p }, { a , s , d , f , g , h , j , k , l , ; }, { z , x , c , v , b , n , m , , , . , / }}; char Tinh(char c) { for (int ... |
#include <bits/stdc++.h> using namespace std; mt19937 mrand(43); const double PI = acos((double)-1); const double eps = 1e-5; const long long inf0 = 1023 * 1024 * 1024; const long long inf = inf0 * inf0; const long long mod = 1e9 + 7; void solve(); void scan(); signed main() { cin.tie(0); co... |
// =============================================================================
// COPYRIGHT NOTICE
// Copyright 2006 (c) Lattice Semiconductor Corporation
// ALL RIGHTS RESERVED
// This confidential and proprietary software may be used only as authorised by
// a licensing agreement from Latt... |
/**
* 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 1ps/1ps
`include "my_defines.vh"
module tb();
parameter N = 4;
parameter DATAW = 128;
reg clk;
reg rst_n;
reg mysig;
reg [127:0] mybus1 ;
reg [3:0] mybus2 ;
wire myout [DATAW-1:0];
my_dut my_dut_inst #(.DATAW(DATAW), .N(N))
(.clk, .rst_n, .sig (mysig),
.bus1(mybus1), ... |
/**
* 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 = 2005; int d[maxN][maxN], c[maxN][maxN], D[maxN], C[maxN], dx[maxN][maxN], cx[maxN][maxN]; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, k; cin >> n >> k; char cur; for (int i = 1; i <= n; ++i) for (int ... |
// Copyright (C) 1991-2013 Altera Corporation
// 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 from any of the foregoing
// (including device programming or simulation files), and any
// associated d... |
/* Clearink */ #include <queue> #include <cstdio> #include <algorithm> #define rep( i, l, r ) for ( int i = l, repEnd##i = r; i <= repEnd##i; ++i ) #define per( i, r, l ) for ( int i = r, repEnd##i = l; i >= repEnd##i; --i ) inline int rint() { int x = 0, f = 1, s = getchar(); for ( ; s < 0 ... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, aa, bb; cin >> a >> b >> aa >> bb; if (aa <= bb) aa = bb + 1; vector<pair<int, int> > ans; if (aa > a) { cout << 0; return 0; } else { for (int i = bb; i <= b; i++) for (int j = (aa > i + 1 ? aa : ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; int t; int main() { cin >> t; while (t--) { int n, m; bool nope = false; cin >> n >> m; for (int i = 0; i != n; i++) { for (int j = 0; j != m; j++) { ll a; cin >> a; if ((a >... |
#include <bits/stdc++.h> using namespace std; int M, R, C, S, T, a[8], b[8], id[8]; vector<vector<vector<int> > > ver; void createVer(int prod, int cur) { if (cur == M) return; for (int i = 1; i <= (int)(a[0]); ++i) for (int j = 1; j <= (int)(prod); ++j) { ver[i][j][cur] = 1; } f... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19:13:50 06/19/2016
// Design Name:
// Module Name: boxmuller_tb
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// De... |
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > vertices; vector<pair<int, int> > edges; int main() { int v; cin >> v; int a, b; queue<int> q; for (int i = 0; i < v; i++) { cin >> a >> b; vertices.push_back(make_pair(a, b)); if (a == 1) { q.pus... |
/**
* 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 dij[4444][4444]; int x[4444], y[4444]; int num[4444]; int main(void) { int n, m; scanf( %d%d , &n, &m); for (int i = 0; i < m; i++) { scanf( %d%d , &x[i], &y[i]); dij[x[i]][y[i]] = dij[y[i]][x[i]] = 1; num[x[i]]++; num[y[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... |
/*
-- ============================================================================
-- FILE NAME : bus_slave_mux.v
-- DESCRIPTION :×ÜÏß´ÓÊô¶à·¸´ÓÃÆ÷ʵÏÖ
-- ----------------------------------------------------------------------------
-- Revision Date Coding_by Comment
-- 1.0.0 2011/06/27 suito ÐÂÒ×÷³É
... |
#include <bits/stdc++.h> const int MAXNUM = 255000; int n; int m; int ecnt; int a[MAXNUM]; int b[MAXNUM]; int inflow[MAXNUM]; int outflow[MAXNUM], direct[MAXNUM]; int head[MAXNUM], to[MAXNUM * 2], next[MAXNUM * 2], c[MAXNUM * 2], from[MAXNUM * 2]; inline int readint() { char c = getchar();... |
// (C) 1992-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 simulati... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Thu May 25 21:01:02 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; const int dx[9] = {0, 1, -1, 0, 0, -1, -1, 1, 1}; const int dy[9] = {0, 0, 0, -1, 1, -1, 1, -1, 1}; const double pi = acos(-1.0); const int N = 110; long long n, m, ans; void input_data() { cin >> n >> m; } void get_ans() { if (n <= m) { ans = n; ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 03/12/2016 06:18:20 PM
// Design Name:
// Module Name: Mux_Array
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// ... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1e17 + 9; double ans = 0; vector<int> adj[100009]; int vis[100009]; double dfs(int x, double prof) { vis[x] = 1; double ret = 1 / prof; for (auto e : adj[x]) { if (vis[e] == -1) ret += dfs(e, prof + 1); } return re... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { int n; string s; cin >> n >> s; int ans = 100; for (int i = 0; i < n; i++) { if (s[i] == > ) { ans... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2.5e5 + 10; template <typename T> inline T read() { T ans = 0, flag = 1; char c = getchar(); while (!isdigit(c)) { if (c == - ) flag = -1; c = getchar(); } while (isdigit(c)) { ans = ans * 10 + (c - 48); ... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; struct P { long long x, y; P() {} P(long long _x, long long _y) : x(_x), y(_y) {} P operator+(const P &o) { return P(x + o.x, y + o.y); } P operator-(const P &o) { return P(x - o.x, y - o.y); } long long operator*(const ... |
#include <bits/stdc++.h> using namespace std; const int N = 505; int a[N]; int dp[N][N]; int deal(int L, int R) { if (L >= R) return 1; if (dp[L][R] != N) return dp[L][R]; if (a[L] == a[R]) dp[L][R] = min(dp[L][R], deal(L + 1, R - 1)); for (int i = L; i < R; ++i) { dp[L][R] = min(dp[L][R... |
#include <bits/stdc++.h> using namespace std; const int MaxN = 14050; template <class t> inline void read(t &s) { s = 0; register int f = 1; register char c = getchar(); while (!isdigit(c)) { if (c == - ) f = -1; c = getchar(); } while (isdigit(c)) s = (s << 3) + (s << 1) + ... |
#include <bits/stdc++.h> using namespace std; int n; int x[411111], d[411111]; int go[20][411111], w[20][411111]; int ma[20][411111]; int comp(int a, int b) { if (a == -1) return b; if (b == -1) return a; if (x[a] + d[a] > x[b] + d[b]) return a; return b; } int main() { cin >> n; ... |
#include <bits/stdc++.h> using namespace std; int main(void) { int n, i, sum; int a[100010]; scanf( %d , &n); for (i = 0; i < n; i++) scanf( %d , &a[i]); sort(a, a + n); sum = a[n - 1]; int f = 1; for (i = 0; i < n - 1; i++) { sum -= a[i]; if (sum < 0) { f = 0; ... |
#include<bits/stdc++.h> #define ll long long int #define ld long double #define pb push_back #define fi first #define se second #define all(x) x.begin(),x.end() #define mem(x,y) memset(x,y,sizeof(x)) #define pii pair<int,int> #define pll pair<ll,ll> #define INF 1e9+10 #define INFL 1e18 #defin... |
#include <bits/stdc++.h> int tcase, m; long long n; int gao(long long x) { int ret = 0; for (; x; x /= 10) ret += x % 10; return ret; } int main() { scanf( %d , &tcase); while (tcase--) { scanf( %lld%d , &n, &m); if (gao(n) <= m) { printf( 0 n ); continue; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[100]; for (int i = 0; i < n; i++) cin >> a[i]; int num[101] = {0}; for (int i = 0; i < n; i++) num[a[i]]++; int cnt = 0; for (int i = 1; i <= 100; i++) cnt += num[i] / 2; cout << cnt / 2 << endl; ... |
#include <bits/stdc++.h> using namespace std; int n, m, a[111], x[111], saven; long double f[2][100111], sum[2][100111]; int main() { ios ::sync_with_stdio(0); cin.tie(0); cout << (fixed) << setprecision(12); while (cin >> n >> m) { int sumA = 0; for (int i = (1), _b = (n); i <= _b; ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.