text stringlengths 59 71.4k |
|---|
/**
* 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 Source Code Form is subject to the terms of the
Open Hardware Description License, v. 1.0. If a copy
of the OHDL was not distributed with this file, You
can obtain one at http://juliusbaxter.net/ohdl/ohdl.txt
Description: RF... |
#include<bits/stdc++.h> using namespace std; #define ll long long int #define v vector<ll> #define pb push_back #define fr(i,a,n) for(ll i=a;i<n;i++) #define Fast ios::sync_with_stdio(false);cin.tie(NULL); #define in(a) ll a;cin>>a #define ip(a) string a;cin>>a #define R(a,n) for(int i=0;i<n;i++)cin>>... |
//-----------------------------------------------------------------------------
// The way that we connect things in low-frequency simulation mode. In this
// case just pass everything through to the ARM, which can bit-bang this
// (because it is so slow).
//
// Jonathan Westhues, April 2006
//-------------------... |
//==================================================================================================
// Filename : musoc.v
// Created On : 2015-01-10 21:18:59
// Last Modified : 2015-05-31 21:23:11
// Revision : 1.0
// Author : Angel Terrones
// Company : Universidad Simón Bolívar
// Em... |
#include <bits/stdc++.h> using namespace std; struct camel { int pos; int tof; }; int main() { cout << setprecision(8) << fixed; double l, d, v, g, r; cin >> l >> d >> v >> g >> r; double temp; double T; temp = d / v; double q; bool yer = 1; while (temp >= 0) { ... |
#include <bits/stdc++.h> using namespace std; const long long N = 2e5 + 520; long long A[N]; long long dp[N]; long long maxl[N]; long long n, m; long long get(long long x, long long y) { if (x == 0) return N - 1; return (x - 1) * m + y; } int main() { cin >> n >> m; A[N - 1] = 0; f... |
// megafunction wizard: %RAM: 2-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: linebuf.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ================================... |
`define WIDTH_P ?
`define PERIOD 10
module test_bsg;
// Enable VPD file dump
initial
begin
$vcdpluson;
$vcdplusmemon;
end
longint ticks = 0;
longint t1 = 0;
longint t2 = 0;
logic clock_in;
logic clock_out;
logic reset;
log... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Case Western Reserve University
// Engineer: Matt McConnell
//
// Create Date: 14:48:00 01/25/2017
// Project Name: EECS301 Digital Design
// Design Name: Lab #2 Project
// Module Name: ... |
#include <bits/stdc++.h> using namespace std; long long int n, m; vector<long long int> a[200005]; long long int rankof[200005]; long long int parentof[200005]; long long int maxof[200005]; void initialize() { for (long long int i = 0; i <= 200005; i++) { rankof[i] = 1; parentof[i] = i; ... |
#include <bits/stdc++.h> using namespace std; int q, n, a[200000 + 5], cnt[200000 + 5]; int main() { scanf( %d , &q); for (; q--;) { memset(cnt, 0, sizeof(cnt)); int sum1 = 0, sum2 = 0, tot = 0, m = 0; scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &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 law... |
/***************************************************************************************************
** fpga_nes/hw/src/cmn/fifo/fifo.v
*
* Copyright (c) 2012, Brian Bennett
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the ... |
#include <bits/stdc++.h> using namespace std; long long n, k, l, r, st; map<pair<long long, long long>, long long> M[2]; long long Count(long long len, long long t, bool w) { if (M[w].count({len, t})) return (M[w][{len, t}]); if (t > len) return (M[w][{len, t}] = 0); if (len == t) return (M[w][{len,... |
`timescale 1ns/10ps
module ssram
(
// global
input wire clk_i,
input wire clk_en_i,
input wire reset_i,
//
output wire treqready_o,
input wire treqvalid_i,
input wire treqdvalid_i,
input wire [31... |
#include <bits/stdc++.h> using namespace std; int main() { int i, n, sum = 0, t; vector<int> a; cin >> n; for (i = 0; i < n; i++) { cin >> t; sum += t; a.push_back(sum); } cin >> n; for (i = 0; i < n; i++) { cin >> t; cout << lower_bound(a.begin(), a.end(), ... |
#include <bits/stdc++.h> using namespace std; char str[50][50]; bool test(int a, int b, int w, int h) { int i, j; for (i = 0; i <= w; i++) { for (j = 0; j <= h; j++) { if (str[i + a][j + b] == 1 ) return 0; } } return 1; } int main() { int n, m, i, j, k, r; scanf( ... |
`timescale 1ns/1ps
module I2CFSM (
input Reset_n_i,
input Clk_i,
// FSM control
input QueryLocal_i,
input QueryRemote_i,
output reg Done_o,
output reg Error_o,
output reg [7:0] Byte0_o,
output reg [7:0] ... |
module mem_window (
clk,
reset,
// Memory slave port
s1_address,
s1_read,
s1_readdata,
s1_readdatavalid,
s1_write,
s1_writedata,
s1_burstcount,
s1_byteenable,
s1_waitrequest,
// Configuration register slave port
cra_write,
cra_writedata,
cra_byteenable... |
#include <bits/stdc++.h> using namespace std; const int next_x[8] = {0, 1, -1, 0, 1, 1, -1, -1}; const int next_y[8] = {1, 0, 0, -1, 1, -1, -1, 1}; const int inf = 1e9 + 5; const long long linf = 1e18 + 5; const double PI = acos(-1.0); const int MAXN = 1e6 + 5; const int N = 4e6 + 5; const long double... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: playback_dump.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... |
#include <bits/stdc++.h> using namespace std; const long long int mod = 1000000007; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); long long int n, h; cin >> n >> h; long long int arr[n]; for (long long int i = 0; i < n; i++) cin >> arr[i]; long long int ... |
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 7, mod = 1e9 + 7, inf = 1e9 + 7; const long long linf = (long long)1e18 + 7; const long double eps = 1e-15, pi = 3.141592; const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1}, dy[] = {0, 1, 0, -1, 1, -1, 1, -1}; inline long long get_ll()... |
#include <bits/stdc++.h> using namespace std; int cnt = 0; int SM[100000]; int ans[500][500][2], FC[500][500][2], H[5]; vector<int> Q[500]; int dfs(int a, int b) { int sum = 0; bool A = false, B = false; for (int i = 0; i < 5; i++) { if (Q[a][i] > 0) { for (int j = 0; j < 5; j++) ... |
// rigidly assume clock = 10mhz.
module rfid_reader_tx (
// basic setup connections
reset, clk, reader_modulation,
// control signals
tx_done, tx_running, tx_go, send_trcal,
// timing information
... |
#include <bits/stdc++.h> using namespace std; long long a[200005]; int main() { int t; cin >> t; while (t--) { memset(a, 0, sizeof(a)); int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); if (a[0] != a[n - 1]) { printf... |
#include <bits/stdc++.h> using namespace std; struct pInfo { int idx; long long reach; pInfo(int i, long long r) { idx = i, reach = r; }; }; long long n, pos[200005], len[200005], R[200005], U[200005][19], S[200005][19], q, a, b; int main() { ios_base::sync_with_stdio(0); cin.tie(0);... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11.06.2015 12:30:30
// Design Name:
// Module Name: testcase_basic
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
/... |
#include <bits/stdc++.h> using namespace std; struct Node { int sum = 0; Node *L = 0, *R = 0; Node() {} Node(int s, Node* l, Node* r) : sum(s), L(l), R(r) {} }; typedef Node* Ptr; Ptr tree[100100]; Ptr create() { Ptr p = new Node(); p->L = p->R = p; return p; } Ptr add(Ptr ro... |
`timescale 1 ps / 1 ps
//-----------------------------------------------------------------------------
// Title : PCI Express BFM Request Interface Common Variables
// Project : PCI Express MegaCore function
//-----------------------------------------------------------------------------
// File :... |
#include <bits/stdc++.h> using namespace std; const long long oo = 1e18; const long long maxn = 2e5, maxm = 1e6, M = 20; struct girl { long long w, id; bool operator<(const girl a) const { return w > a.w; } }; pair<long long, long long> operator+(pair<long long, long long> a, ... |
/* S-box using all normal bases */
/* case # 4 : [d^16, d], [alpha^8, alpha^2], [Omega^2, Omega] */
/* beta^8 = N^2*alpha^2, N = w^2 */
/* optimized using OR gates and NAND gates */
/* square in GF(2^2), using normal basis [Omega^2,Omega] */
/* inverse is the same as square in GF(2^2), using any normal basis */
... |
#include <bits/stdc++.h> using namespace std; int pri[100003], top, n; bool ntp[100002]; struct node { int a, b; bool operator<(const node &rhs) const { return b > rhs.b; } }; void euler() { for (int i = 2; i <= 100000; ++i) { if (!ntp[i]) pri[top++] = i; for (int j = 0; j < top && p... |
/**
* 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: 16:35:40 05/31/2016
// Design Name:
// Module Name: Contador_AD_Dia
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies... |
#include <bits/stdc++.h> using namespace std; const int N = 105; const int oo = 1e9; int g[N][N], n, m; int col[N]; vector<pair<int, int> > ans; pair<int, int> get(int val) { for (int i = 1; i <= m; ++i) { if (g[1][i] < val) return {oo, val}; } memset(col, 0, sizeof(col)); ans.clear(... |
#include <bits/stdc++.h> using namespace std; const long long int maxN = 1e5 + 10; long long int n, i, a[maxN], mx, cnt, nxt; stack<pair<long long int, long long int> > st; int main() { cin >> n; for (long long int i = 0; i < n; i++) cin >> a[i]; for (long long int i = n - 1; i >= 0; i--) { ... |
// Copyright (c) 2000-2011 Bluespec, Inc.
// 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, publ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2020 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
`ifdef USE_INLINE
`define INLINE_MODULE /*verilator inline_module*/
`else
`define INLINE_MODULE /*verila... |
#include <bits/stdc++.h> using namespace std; const int N = 100010; const int INF = 0x3f3f3f3f; const int iinf = 1 << 30; const long long linf = 2e18; const int MOD = 1000000007; void print(int x) { cout << x << endl; exit(0); } void PRINT(string x) { cout << x << endl; exit(0); } ... |
// $Header: /devl/xcs/repo/env/Databases/CAEInterfaces/verunilibs/data/unisims/IBUFG.v,v 1.7 2007/05/23 21:43:34 patrickp Exp $
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2004 Xilinx, Inc.
// All Right Reserved.
/////////////////////////////////////////////////... |
//-----------------------------------------------------------------------------
// Title : Block-level Virtex-6 Embedded Tri-Mode Ethernet MAC Wrapper
// Project : Virtex-6 Embedded Tri-Mode Ethernet MAC Wrapper
// File : v6_emac_v1_5_block.v
// Version : 1.5
//-----------------------------------------... |
/**
* 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; void solve() { string s, s1; cin >> s; int count = 0; sort(s.begin(), s.end()); for (int i = 0; i < s.length(); ++i) { if (s[i] == + ) count++; } std::vector<string> v(s.length()); for (int i = count; i < s.length(); ++i) { v... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2014.4
// Copyright (C) 2014 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1 ns / 1 ps
m... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 18:50:03 03/02/2016
// Design Name:
// Module Name: Control_visualizador_numerico
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
/... |
#include <bits/stdc++.h> using namespace std; int countdigits(int n) { int i, b = 0; while (n) { b++; n = n / 10; } return b; } int main() { int t, i, n, x, cnt = 0; cin >> t; for (i = 0; i < t; i++) { cin >> n; cnt = countdigits(n); n = n % 10; if... |
// ----------------------------------------------------------------------
// Copyright (c) 2016, The Regents of the University of California All
// rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:... |
// Murabito-B 21/04/13 #include <bits/stdc++.h> using namespace std; using ll = long long; void solve() { int a, b, c; cin >> a >> b >> c; for (int i = 0; i <= a - c; ++i) cout << 1; for (int i = 1; i < c; ++i) cout << 0; cout << 1 ; for (int i = 1; i < b; ++i) cout << 0; ... |
/* This file is part of jt51.
jt51 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.
jt51 is distributed in the hope tha... |
#include <bits/stdc++.h> using namespace std; const int maxx = 500 + 7; const int maxn = 100 + 7; const long long mod = 1E9 + 7; const int maxs = 2 * (1E7) + 5; const int maxm = 100 + 3; const long long maxk = 1e13; long double dp[maxn][maxn]; int last[1000]; char seq[maxn]; long long n, k; void... |
`timescale 1 ns/100 ps
//------------------------------------------------------------------------------
// Copyright (c) 2012 Kirk Weedman, KD7IRS,
//------------------------------------------------------------------------------
// NOTE: 1. Input angle is a modulo of 2*PI scaled to fit in a 32bit register. ... |
#include <bits/stdc++.h> using namespace std; using point = complex<double>; const int T = 1 << 16; point root[T]; void fft(vector<point>& a) { int n = a.size(); vector<int> reverse(n); for (int i = 0; i < n; ++i) { reverse[i] = (reverse[i / 2] + (i % 2) * n) / 2; if (i < reverse[i]) {... |
// handle receives over UART
module uart_rx
(
input wire clk,
input wire reset,
input wire rx,
input wire s_tick,
output reg rx_done_tick,
output wire [7:0] dout
);
parameter DBIT = 8;
parameter SB_TICK = 16;
localparam IDLE = 0;
localparam START = 1;
localparam DATA ... |
/*
* 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 n, k; string str[400007]; long long int a[400007], p[400007][4]; long long int m1[200005], m2[200005]; int main() { string s; cin >> s; for (int i = 0; i < s.length(); i++) { if (s[i] == A ) { p[i][0] = 1; if (i -... |
// 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; long long a[n]; for (int i = 0; i < n; i++) cin >> a[i]; long long mx = 1e9 + 9, r = 0; for (int i = n - 1; i >= 0; i--) { a[i] = min(mx, a[i]); r += a[i]; mx = min(mx, max(0ll, a[i] - 1)); } ... |
module cast_large_real;
reg [63:0] u64;
reg signed [63:0] i64;
reg [64:0] u65;
reg signed [64:0] i65;
real r;
reg fail;
initial begin
fail = 0;
u64 = {1'b1, 63'd0};
r = u64;
$display("Convert u64 to real");
$display("Expect : %0f", 2.0**63);
$display("Got : ... |
module unpipeline #
(
parameter WIDTH_D = 256,
parameter S_WIDTH_A = 26,
parameter M_WIDTH_A = S_WIDTH_A+$clog2(WIDTH_D/8),
parameter BURSTCOUNT_WIDTH = 1,
parameter BYTEENABLE_WIDTH = WIDTH_D,
parameter MAX_PENDING_READS = 64
)
(
input clk,
input resetn,
// Slave port
input [S_... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; long long powmod(long long a, long long b) { long long res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1) res = res * a % mod; a = a * a % mod; } return res; } long long gcd(long... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; int main() { int n, tf = 0, f = 0, hun = 0; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 25) tf++; else if (a[i] == 50) { f++; tf--; } else { hun++; if (f >= 1)... |
/*
* 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... |
/**
* 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... |
// Icarus 0.7, cvs files from Feb 2, 2003
// --------------------------------------
//
// iverilog precision.v
// or
// iverilog -D DUMP precision.v
// vvp a.out
//
// Use & display of real time periods with `timescale set to 1 ns / 10 ps
//
// $simtime keeps time in 10ps increments
// $simtime ... |
// (C) 2001-2016 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated doc... |
/**
* 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 treas[310][310]; long long dp[310][310]; long long d[310][310]; vector<pair<int, int> > G[110000]; vector<pair<long long, pair<int, int> > > lst; queue<pair<long long, pair<int, int> > > bfs; int dir[4][2] = {{-1, 0}, {1, 0}, {0, 1}, {0, -1}}; long lon... |
/*
* 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... |
#include <bits/stdc++.h> using namespace std; vector<long long> v; bool vis[10005]; long long n, m, k; int main() { cin >> n >> m >> k; if ((n * m * 2) % k != 0) puts( NO ); else { puts( YES ); puts( 0 0 ); if ((n * 2) % k == 0) { printf( %lld 0 n , n * 2 / k); ... |
/**
* 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... |
//-----------------------------------------------------------------------------
//-- Baudrate generator
//-- It generates a square signal, with a frequency for communicating at the given
//-- given baudrate
//-- The output is set to 1 only during one clock cycle. The rest of the time is 0
//-- Once enabled, the pulse i... |
#include <bits/stdc++.h> using namespace std; const int mx = 5005; int type[mx], dp[mx]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; for (int i = 1; i <= n; i++) { double x; cin >> type[i] >> x; } for (int i = 1; i ... |
module CY7C67200_IF( // HOST Side
iDATA,
oDATA,
iADDR, //for HPI register selection
iRD_N,
iWR_N,
iCS_N,
iRST_N,
iCLK,
oINT,
// CY7C67200 Side
// OTG_ID, //HPI mode selection(host or peripheral)
HPI_DATA,
HPI_ADDR,
HPI_RD_N,
... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int t[n + 1]; for (int i = 0; i < n; i++) { cin >> t[i]; } for (int i = 0; i < n; i++) { int tt = t[i]; for (int j = 1; j <= tt; j++) cout << j << ; cout << endl; } return 0; } |
#include <bits/stdc++.h> using namespace std; const int N = 200005; long long c[N << 2], a[N]; void pushup(int rt) { c[rt] = c[rt << 1] | c[rt << 1 | 1]; } void build(int rt, int l, int r) { if (l == r) { scanf( %I64d , c + rt); a[l] = c[rt]; return; } int mid = (l + r) >> 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 mxn = 300001; int n; long long a[mxn], dp[mxn]; map<int, int> first[mxn]; void answer() { cin >> n; long long ret = 0; for (int i = 1; i <= n; i++) { cin >> a[i]; first[i].clear(); if (first[i - 1].count(a[i])) { i... |
/*
Copyright 2018 Nuclei System Technology, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except i... |
#include <bits/stdc++.h> using namespace std; template <typename T> void scanv(vector<T>& v, int n) { v.resize(n); for (int i = 0; i < n; i++) cin >> v[i]; } template <typename T> void scanvv(vector<vector<T> >& v, int n, int m) { v.resize(n); for (int i = 0; i < n; i++) scanv(v[i], m); } ... |
#include <bits/stdc++.h> using namespace std; long long num[200000]; pair<long long, long long> p[200000]; int main() { long long n, m, k, sum = 0, cnt = 1; cin >> n >> m >> k; for (int i = 1; i <= n; i++) { cin >> p[i].first; p[i].second = i; } sort(p + 1, p + n + 1); for (i... |
#include <bits/stdc++.h> using namespace std; int a, b, c, d, k, t; int main() { cin >> t; while (t--) { cin >> a >> b >> c >> d >> k; bool isok = 0; for (int i = 1; i <= k; i++) { if (i * c >= a && (k - i) * d >= b) { isok = 1; cout << i << << k - i << en... |
/*
* 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 (c) 2014 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute,... |
//////////////////////////////////////////////////////////////////////
//// ////
//// OR1200's Instruction TLB ////
//// ////
//// This file is part of the OpenR... |
#include <bits/stdc++.h> using namespace std; const long long inf = 1e15; const int N = 2e5 + 10; int I[N], st[N], fn[N], par[N], h[N], sz[N], big[N], hd[N], n, m, q, timer; long long w[N]; vector<int> g[N], V[N]; struct Node { pair<long long, long long> Mn; long long Lazy = 0; } seg[N << 2]; ... |
#include <bits/stdc++.h> template <typename T> void MACRO_VAR_Scan(T& t) { std::cin >> t; } template <typename First, typename... Rest> void MACRO_VAR_Scan(First& first, Rest&... rest) { std::cin >> first; MACRO_VAR_Scan(rest...); } template <typename T> void MACRO_VEC_ROW_Init(int n, T& 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... |
#include <bits/stdc++.h> using namespace std; int n, m, nxt[100010], pre[100010]; pair<int, int> b[100010]; struct Frog { int p, a, id; } a[100010]; set<pair<int, int> > s; inline bool operator<(Frog a, Frog b) { return a.p < b.p; } inline int cal(int i, int j) { if (i == j) return 0x7fffffff; ... |
#include <bits/stdc++.h> using namespace std; ostream &operator<<(ostream &out, vector<long long> &a) { for (auto i : a) out << i << ; return out; } istream &operator>>(istream &in, vector<long long> &a) { for (auto &i : a) in >> i; return in; } int main() { cin.tie(0); cout.tie(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... |
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2015 *)
(* \VV/ **************************************************************)
(* // * Th... |
#include <bits/stdc++.h> const long long mod = 1000000007; long long qpow(long long v, long long st) { long long r = 1; while (st) { if (st & 1) { r *= v; r %= mod; } v = v * v; v %= mod; st = st / 2; } return r; } long long f[1024]; long long dp[1... |
#include <bits/stdc++.h> using namespace std; pair<pair<long long, long long>, long long> merge_p( pair<long long, long long> a, pair<long long, long long> b) { if (a.first > b.first) swap(a, b); if (b.first <= a.second) { if (b.second <= a.second) return make_pair(b, 0); else ... |
#include <bits/stdc++.h> using namespace std; long long a[1000009]; int pre[10000009]; vector<long long> alr; int main() { int n; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); reverse(a, a + n); long long ans = 0, ans1 = 0; int taken = 0; for (int i = 0; i ... |
#include <bits/stdc++.h> using namespace std; const int N = 205; const int mod = 1e9 + 7; long long f[2][N][N]; int n, tot; struct point { long long x, y; point(long long _x = 0, long long _y = 0) { x = _x; y = _y; } point operator-(const point &rhs) const { return point(x ... |
/*
Copyright (C) {2014} {Ganesh Ajjanagadde} <>
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.
This program is distributed i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.