text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; inline int read() { int 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 * 10 + ch - 0 ; ch = getchar(); } return x * f;...
#include <bits/stdc++.h> using namespace std; int n, k, x, y; int main() { cin >> n >> k; int l = 1, r = n, mid; while (l <= r) { if (l == r) { x = l; break; } mid = l + r >> 1; cout << 1 << mid << << mid + 1 << endl; fflush(stdout); string s;...
/** * 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 "bsg_defines.v" `ifndef DATA_WIDTH `define DATA_WIDTH 8 `endif `ifndef ADDR_WIDTH `define ADDR_WIDTH 10 `endif module testbench (); localparam width_p = `DATA_WIDTH; localparam data_width_p = width_p; localparam mask_width_p = width_p>>3; localparam els_p=(1<<`ADDR_WIDTH); localparam addr_w...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e9 + 7; const int N = 5e2 + 10; int a[N][N]; int b[N][N]; int c[N][N]; int minv[N]; int main() { int n, m, k; scanf( %d%d%d , &n, &m, &k); memset((minv), (0x3f), sizeof(minv)); for (int i = 1; i <= n; i++) { scanf...
//---------------------------------------------------------------------------- //-- Ejemplo de uso de una memoria rom generica //-- Se reproduce en los leds la secuencia definida en el fichero rom1.list //------------------------------------------ //-- (C) BQ. October 2015. Written by Juan Gonzalez (Obijuan) //-- GPL l...
(* Copyright (c) 2008-2012, Adam Chlipala * * This work is licensed under a * Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 * Unported License. * The license text is available at: * http://creativecommons.org/licenses/by-nc-nd/3.0/ *) Require Import Eqdep List Lists.List. Require Omega....
#include <bits/stdc++.h> using namespace std; std::mt19937 rnd( (int)std::chrono::steady_clock::now().time_since_epoch().count()); long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } const int MAXH = 100000; const int MAXW = 100000; const int MAXDIM = MAXH >= MAXW ? MAXH : M...
/* * 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; long long int pow_mod(long long int a, long long int b) { long long int res = 1; while (b != 0) { if (b & 1) { res = (res * a) % 1000000007; } a = (a * a) % 1000000007; b /= 2; } return res; } long long int inv(long lo...
#include <bits/stdc++.h> using namespace std; int main() { std::ios_base::sync_with_stdio(false); cin.tie(0); long long int n, i, j, x, in = 0; string s; vector<pair<string, long long int>> v; priority_queue<long long int, vector<long long int>, greater<long long int>> pq; cin >>...
#include <bits/stdc++.h> using namespace std; const int nax = 3e5 + 5; int nxt[nax][20]; int reach[20]; int main() { int n, q; cin >> n >> q; vector<int> arr(n); for (int i = 0; i < n; i++) cin >> arr[i]; for (int bit = 0; bit < 19; bit++) reach[bit] = n; for (int i = n - 1; i >= 0; 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 law...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; struct T { T *l, *r; int v; int c; T(int v) : v(v), c(1) { l = r = NULL; } T(T *a) { l = a->l; r = a->r; v = a->v; c = a->c; } T() {} }; T pool[(5000000) + 10000]; int stack_size; T *my_new(int v) { return &(po...
#include <bits/stdc++.h> using namespace std; using LL = long long; using ULL = unsigned long long; using VI = vector<int>; using VL = vector<LL>; using PII = pair<int, int>; using PLL = pair<LL, LL>; void dout() { cerr << endl; } template <typename Head, typename... Tail> void dout(Head H, Tail... ...
/*--------------------------------------------------------------------------------------------------------------------- -- Author: Peter Hasza, -- -- Create Date: 04/02/2017 -- Module Name: fifo -- Project Name: AXI_SPI_IF -- Description: -- Generic fifo module -- ------------------...
// 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 : Mon Feb 13 12:44:42 2017 // Host : WK117 running 64-bit major release (build ...
/** * 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...
////////////////////////////////////////////////////////////////////// //// //// //// Generic Single-Port Synchronous RAM //// //// //// //// This file is part of memory li...
/* Copyright (c) 2014-2017 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 main() { int n, i, cnt; string s; map<int, pair<int, int> > mapp; cin >> n; cin >> s; cnt = 0; int maxm = 0; for (i = 0; i < n; i++) { if (s[i] == 0 ) cnt--; else cnt++; if (mapp.find(cnt) == mapp.en...
#include <bits/stdc++.h> using namespace std; int FuN(long long n) { string s; while (n != 0) { int ch = (n % 2); s += ch + 0 ; n /= 2; } int x = -1; for (int i = 0; i < s.size(); i++) { if (s[i] == 1 ) x = i + 1; } return x; } int main() { int t, n, i, ...
// *************************************************************************** // *************************************************************************** // Copyright 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const int neginf = 0xc0c0c0c0; const int mod = 1000000007; bool cmp(const double& a, const double& b, const double TOL = 1e-9) { return (a + TOL > b) ? (b + TOL > a) ? 0 : 1 : -1; } long long powmod(long long a, long long b) { ...
#include <bits/stdc++.h> using namespace std; int main() { int T; cin >> T; for (int t = 0; t < T; t++) { int n; cin >> n; int a[n], b[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { cin >> b[i]; } int differe...
/* Made by brandon for brandon. * I guarantee absolutely nothing and am not liable for any damages. */ //======================================================= // This code is generated by Terasic System Builder //======================================================= module DE0_Nano( //////////// CLOCK ////...
module test_RegWaitRW32( //Avalon System control signal. input rsi_MRST_reset, // reset_n from MCU GPIO input csi_MCLK_clk, //Avalon-MM Control. input [31:0] avs_test_writedata, output [31:0] avs_test_readdata, input [5:0] avs_test_address, input [3:0] avs_test_byteenable, input avs_test_write, input ...
// 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 : Tue Sep 17 19:45:28 2019 // Host : varun-laptop running 64-bit Service Pac...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: sctag_pcx_rptr_2.v // Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. // // The above named program is free software; you can redistribute it ...
#include <bits/stdc++.h> using namespace std; vector<int> primes; int dp[101][1 << 18], n, a[111], man, ansd[111], loc[100]; vector<int> fact[100]; int rec(int i, int mask) { if (i == n) return 0; if (dp[i][mask] != 1000000000) return dp[i][mask]; int dif = abs(a[i] - 1); int ans = rec(i + 1, ...
#include <bits/stdc++.h> using namespace std; const long long M = 998244353; long long power(long long a, long long b, long long m) { long long res = 1; a %= m; while (b) { if (b & 1LL) res = res * a % m; a = a * a % m; b >>= 1; } return res; } int32_t main() { ios_ba...
//***************************************************************************** // (c) Copyright 2008-2009 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 // ...
// (C) 2001-2016 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 any of the foregoing (including device programming or simulation // files), and any associated docum...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast,no-stack-protector,unroll-loops ) #pragma GCC optimize( no-stack-protector,fast-math ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; template <class S, class T> inline S smax(S &l, T r) { return 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...
/** * 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 module is dual port ram with 2 I/O ports * this ram can read / write data to ports 0 and 1 simulataniously * * Author: Kimi */ `ifndef _dp_ram_duo `define _dp_ram_duo `timescale 1ns /1ps //////////////////////////////////////////// // start of behavioral RAM implemintation // /////////////////////////...
#include<iostream> #include<vector> #include<queue> #include<cstring> #include<cmath> #include<map> #include<set> #include<cstdio> #include<algorithm> #define debug(a) cout<<#a<< = <<a<<endl; using namespace std; const int maxn=1e3+100; typedef long long LL; LL a[maxn]; int main(void) { ...
#include <bits/stdc++.h> using namespace std; int32_t main() { long long q; cin >> q; for (long long i = 0; i < q; i++) { long long a, b, c; cin >> a >> b >> c; long long ans = 0; long long num = min(min(a, b), c); ans += num; a -= num; b -= num; c -= num;...
#include <bits/stdc++.h> using namespace std; int main() { long long K, A, B, V; cin >> K >> A >> B >> V; long long nuts = A; long long divisors = B; long long capacity = V; long long maxSections = K; int boxes = 0; while (nuts > 0) { boxes++; int sections = min(divisors ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long n, k; cin >> n; vector<long long> dp(n + 3, 0); vector<long long> v; long long sum = 0; for (int j = 0; j < n; j++) { cin >> k; if (j % 2 == 0) { ...
#include <bits/stdc++.h> using namespace std; int main() { long long int t, n; cin >> t; while (t--) { cin >> n; long long int c = 0; string s = ; cin >> s; string h = s; sort(h.begin(), h.end()); for (int j = 0; j < n; j++) if (h.at(j) != s.at(j)) c++...
/* * Copyright (c) 1998-2000 Stephen Williams () * * 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...
module example; reg [7:0] vec; reg [3:0] ix; wire vix = vec[ix]; initial begin $display( " time ix vix vec" ); $display( " ---- ---- --- --------" ); $monitor( "%T %b %b %b", $time, ix, vix, vec ); vec = 8'b00000000; ...
/** * 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 1995-2016 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 license and does not grant ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2003 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc; initial cyc=1; // veril...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int cnt = 0; for (int i = 0; i < n; i++) { if (s[i] == + ) { cnt++; } else if (s[i] == - && cnt) { cnt--; } } cout << cnt << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { string str; cin >> str; for (int i = 1; i < str.size() - 1; i++) { if (str[i + 1] != . && str[i - 1] != . && str[i] != . ) { if (str[i + 1] != str[i - 1] && str[i - 1] != str[i] && str[i + 1] != str[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 (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ * * Chuck Benz, Hollis, NH Copyright (c)2002 * * The information and description contained h...
#include <bits/stdc++.h> int vv[(1 << 16) + 1], ff[(1 << 16) + 1], gg[(1 << 16) + 1], bcnt[(1 << 16)]; void init() { int i; ff[0] = gg[0] = 1; for (i = 1; i <= (1 << 16); i++) { vv[i] = i == 1 ? 1 : (long long)vv[i - 998244353 % i] * (998244353 / i + 1) % ...
`timescale 1ns / 1ps //----------------------------------------------- // Company: agh // Engineer: komorkiewicz // Create Date: 23:14:48 04/19/2011 // Description: vga generator //----------------------------------------------- module hdmi_in ( //hdmi outputs output reg hdmi_clk, output hdmi_de, output hdmi_h...
// // Paul Gao 02/2021 // // This is the sender part of bsg_link_sdr, an SDR communication endpoint // over single source-synchronous channel. // // Typical usage: Communication between different hierarchical blocks in // different clock domains on ASIC. In this way the clock trees can be // fully independen...
#include <bits/stdc++.h> using namespace std; const int inf = 1e9 + 7; const int N = 230; const int M = 3500; int m, n; int a[N], b[N]; long long dp[M][N]; int main() { cin >> m >> n; memset(dp, 0, sizeof(dp)); for (int i = 0; i < m; ++i) { cin >> a[i] >> b[i]; dp[a[i]][i]++; ...
/* * Milkymist 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 distribut...
`default_nettype none `include "irq.h" /**** HOLD 0 START 1 MOVE_K2U 1 MOVE_UK 2 EMD */ module execute_exception_check_ldst( input wire iCLOCK, input wire inRESET, input wire iRESET_SYNC, //Event CTRL input wire iEVENT_HOLD, input wire iEVENT_START, input wire iEVENT_IRQ_FRONT2BACK, input wire iEVE...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: Jafet Chaves Barrantes // // Create Date: 15:45:17 04/03/2016 // Design Name: // Module Name: contador_AD_SS_T_2dig // Project Name: // Target Devices: // Tool versions: // Desc...
#include <bits/stdc++.h> using namespace std; char s[1010][3][50]; bool p[1010]; int main() { int n, i, j, c; cin >> n; for (i = 1; i <= n; i++) cin >> s[i][1] >> s[i][2]; memset(p, true, sizeof(p)); for (i = 1; i <= n; i++) { for (j = 1; j <= n; j++) { if (i != j) { ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty. // SPDX-License-Identifier: CC0-1.0 module some_module ( input [3:0] i_clks ); logic [ 1 : 0 ] some_state; logic [1:0] some_other_state; always @(posedge i...
/** * Module: example * * Description: * A parametrized example that uses the arbiter and timers. The 'request' * asks for ownership of shared resource. The 'grant' indicates that * ownership has been given. The 'active' is high when an actor (any actor) * has been granted ownership. * * Created: * Sun J...
#include <bits/stdc++.h> using namespace std; int n; vector<vector<int>> a; bool inp(int i, int j) { (i < n && j == n) && inp(i + 1, 0); (i < n && j < n) && (cin >> a[i][j]); (i < n && j < n) && (inp(i, j + 1)); return 0; } bool floyd(int k, int i, int j) { (k < n && i < n && j == n) && ...
#include <bits/stdc++.h> using namespace std; int main() { int arr[4]; cin >> arr[0] >> arr[1] >> arr[2] >> arr[3]; sort(arr, arr + 4); if ((arr[0] + arr[3]) == (arr[1] + arr[2]) || (arr[0] + arr[1] + arr[2]) == arr[3]) { cout << YES << n ; } else { cout << NO << n ; ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const int MaxN = 100010; struct adjList { int id, nxt; } Lst[MaxN * 2]; int LCnt, Head[MaxN]; int N, w[MaxN], root; void addEdge(int a, int b) { Lst[LCnt].id = b; Lst[LCnt].nxt = Head[a]; Head[a] = LCnt++; } pair<long long, long long> dfs(i...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; typedef long long ll; typedef unsigned long long ull; template <typename T> bool umax(T& a, const T& b) { return b <= a ? false : (a = b, true); } template <typename T> bool umin(T& a, const T& b) { return b >= a ? false...
#include <bits/stdc++.h> long long t1[100], t2[100], n, k, m, i, j, mod[10], o, s; int main() { scanf( %I64d %I64d %I64d , &n, &k, &m); t1[0] = 1; for (i = 0; i < 10; i++) mod[i] = i % k; for (i = 1; i <= n; i++) { for (j = 0; j < 10; j++) { if (j == 0 && (i == n || i == 1)) continue; ...
//***************************************************************************** // (c) Copyright 2009 - 2012 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 /...
#include <bits/stdc++.h> using namespace std; template <class T> void chmax(T& a, const T& b) { a = max(a, b); } template <class T> void chmin(T& a, const T& b) { a = min(a, b); } using ll = long long; using P = pair<int, int>; using VI = vector<int>; using VVI = vector<VI>; using VL = v...
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const long long mod1 = 998244353; const double pie = 3.1415926535; long long power(long long x, long long y) { if (y == 0) return 1; else { if (y % 2 == 0) return power(x * x, y / 2); else re...
#include <bits/stdc++.h> using namespace std; unsigned long long gcd(unsigned long long a, unsigned long long b) { return b == 0 ? a : gcd(b, a % b); } const int MAXTREE = 50; const int MOD = 998244353; const int INV6 = 166374059; const int MINCOORD = -1000000000; const int MAXCOORD = +1000000000; ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const int N = 150000; const int L = 19; vector<int> edges[N]; long long x[N], y[N]; int anc[N][L], tin[N], tout[N], s[N], moment; void dfs(int x, int last) { tin[x] = ++moment; anc[x][0] = last; for (int i = 1; i < L; i++) anc[x][i] = anc[anc[x][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; int arr[100005]; int lfl[100005]; int rfl[100005]; int main() { int n; cin >> n; int i, j; for (i = 1; i <= n; i++) { cin >> arr[i]; } for (i = 1; i <= n; i++) { lfl[i] = min(lfl[i - 1] + 1, arr[i]); } long long ans = IN...
module avr_interface #( parameter CLK_RATE = 50000000, parameter SERIAL_BAUD_RATE = 500000 )( input clk, input rst, // cclk, or configuration clock is used when the FPGA is begin configured. // The AVR will hold cclk high when it has finished initializing. // It is important not to dr...
#include <bits/stdc++.h> long long Max(const long long x, const long long y) { if (x > y) return x; return y; } const long long mo = 1e9 + 7, M = 1005; char s[M]; long long k, a[M], len, dp[M][M][2]; long long dfs(const long long pos, const long long dis, const bool pd, const bool li...
#include <bits/stdc++.h> using namespace std; void solve() {} const int maxn = (int)1e6 + 420; const int MOD = (int)1e9 + 7; int n; int dp[maxn][4][4]; void contr() { cout << 0 << n ; exit(0); } int madd(int a, int b) { long long sum = a + b; sum %= MOD; return sum; } signed ...
`define bsg_nor3_macro(bits) \ if (harden_p && (width_p==bits)) \ begin: macro \ bsg_rp_tsmc_250_NOR3X1_b``bits nor3_gate (.i0(a_i),.i1(b_i),.i2(c_i),.o); \ end module bsg_nor3 #(parameter `BSG_INV_PARAM(width_p) , paramet...
#include <bits/stdc++.h> struct Seg { int l; int r; int y; }; struct Event { int x; enum { BEG, END } type; Seg seg; static Event beginOf(Seg seg) { return Event{seg.l, BEG, seg}; } static Event endOf(Seg seg) { return Event{seg.r, END, seg}; } friend bool operator<(const Event...
//////////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2013, University of British Columbia (UBC); All rights reserved. // // // // Redistribution and use in source and binary forms, w...
/** * 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 //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 17:04:55 07/15/2014 // Design Name: cic_decim // Module Name: U:/GitHubA2300_ltxdev/hdl/test/cic_decim_stimulus.v // Project Name: Asr2300FpgaCore_2chrx // Target De...
/** * 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 mxn = 257; string rec[mxn][3]; bool been[mxn][3]; inline int G(string s) { int t = 0; for (int i = 0; i < s.size(); ++i) t = t * 2 + s[i] - 0 ; return t; } priority_queue<pair<int, int> > pq; bool changed; string Min(string a, string...
//Legal Notice: (C)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 associate...
#include <bits/stdc++.h> using namespace std; vector<int> v[200010], circle; int fa[200010], dep[200010], a[200010], b[200010], n, rt, vs, vt, h1, h2; bool vis[200010], bo[200010]; inline int rd() { int x = 0; char ch = getchar(); for (; ch < 0 || ch > 9 ; ch = getchar()) ; for (; ch ...
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const int mod = 1000000007; const long long linf = 0x3f3f3f3f3f3f3f3f; char c[200100]; int qnt[200100][26]; int main() { int t; scanf( %d , &t); while (t--) { int n, k; scanf( %d%d , &n, &k); scanf( %s...
#include <bits/stdc++.h> using namespace std; vector<pair<long long, long long> > vp, pp; int h[105][105]; int a[105], b[104]; int main() { int n, m, k; cin >> n >> m >> k; for (int i = 0; i < m; i++) cin >> a[i]; for (int i = 0; i < n; i++) cin >> b[i]; int x; for (int i = 0; i < n; i...
#include <bits/stdc++.h> using namespace std; int main() { int k; cin >> k; int a[k + 1]; for (int i = 0; i < k; i++) cin >> a[i]; long long int comb[1005][1005]; comb[0][0] = 1; for (int i = 1; i < 1005; i++) { comb[i][0] = 1; for (int j = 1; j <= i; j++) { comb[i][j...
#include <bits/stdc++.h> using namespace std; const int maxn = 200005; vector<int> lk[maxn]; int fa[maxn], dep[maxn], a[maxn], b[maxn], n; void dfs(int now, int pre) { fa[now] = pre; dep[now] = dep[pre] + 1; for (auto p : lk[now]) if (p != pre) dfs(p, now); } vector<int> cir; int rt, l...
#include <bits/stdc++.h> using namespace std; const long long MAX_N = 1e5 + 5; long long n, val; pair<pair<long long, long long>, pair<long long, long long> > edge[MAX_N]; long long par[MAX_N]; long long len[MAX_N]; vector<long long> h; vector<long long> ans; vector<pair<long long, long long> > G[MAX_...
#include <bits/stdc++.h> using namespace std; int flash_drives[100001]; int main() { int n, m; scanf( %d%d , &n, &m); for (int i = 0; i < n; i++) { scanf( %d , &flash_drives[i]); } sort(flash_drives, flash_drives + n, greater<int>()); int l = 0; int sum = 0; for (int i = 0; i...
#include <bits/stdc++.h> using namespace std; const long long MAXN = +100500; const long long INF = 4e18; long long a[MAXN]; int main() { long long n, k; cin >> n >> k; for (int i = 1; i <= n; i++) { cin >> a[i]; } if (k >= 3) { sort(a + 1, a + n + 1); cout << a[n]; ...
#include <bits/stdc++.h> using namespace std; int n; string s; vector<vector<int> > dp; vector<int> res; void recalc(char col) { dp = vector<vector<int> >(n + 1, vector<int>(n + 1, 0)); res = vector<int>(n, 0); for (int(i) = 0; (i) < (n + 1); ++(i)) dp[i][0] = 0; for (int(ncur) = (1); (ncur)...
/** * 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 double eps = 1e-8; const double pi = acos(-1.0); const long long INF = 0x3f3f3f3f3f3f3f3f; const int inf = 0x3f3f3f3f; const long long mod = 1e9 + 7; const int N = 1e5 + 10; struct zz { long long x, y; } a[N]; bool check(zz z1, zz z2, zz y1, zz...
/* * This module demonstrates the ability to use a defparam to control * the instantation of an instance array, and to also control * parameter values within the instance array. */ module main; localparam wid = 5; reg [wid-1:0] clk; if (wid > 0) begin : D dut xx (.clk(clk)); end // This def...