text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> int n; char S[300000]; struct edge { int to, nxt; } E[500000]; int H[500000], tot; inline void add_edge(int a, int b) { E[++tot] = (edge){b, H[a]}, H[a] = tot; } struct SegmentTree { struct node { node *L, *R; node() { L = R = NULL; } }; node *root; ... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-9; bool doubleEquals(double a, double b) { return abs(a - b) < eps; } bool db_less(double a, double b) { return a < b - eps; } bool db_equal(double a, double b) { return abs(a - b) < eps; } bool db_less_equal(double a, double b) { return a ... |
module amm_master_qsys_with_pcie (
clk_50_clk,
custom_module_conduit_rdwr_cntl,
custom_module_conduit_n_action,
custom_module_conduit_add_data_sel,
custom_module_conduit_rdwr_address,
custom_module_conduit_display_data,
pcie_ip_clocks_sim_clk250_export,
pcie_ip_clocks_sim_clk500_export,
pcie_ip_clocks_sim_clk... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
//TODO: check with more then 1 hold/priority at a ti... |
#include <bits/stdc++.h> int main() { int n; scanf( %d , &n); std::vector<std::pair<int, int> > a(n + 1); for (int p = 0; p < n; p++) { int x; scanf( %d , &x); a[p] = std::make_pair(x, p + 1); } sort(++a.begin(), a.end(), std::greater<std::pair<int, int> >()); int ind(0);... |
// ==================================================================
// >>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<
// ------------------------------------------------------------------
// Copyright (c) 2006-2011 by Lattice Semiconductor Corporation
// ALL RIGHTS RESERVED
// --------... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; struct node { int x, y, c; } s[2005], tmp[2005]; int n, k, l, cx, cy; int lx[2005], ly[2005], bk[2005]; multiset<int> t[2005]; namespace Tree { int mn[8005], mx[8005], sum[8005], lzy[8005]; inline void pushtag(int p, int l, i... |
/*
Copyright (c) 2019 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,... |
/*
Distributed under the MIT license.
Copyright (c) 2011 Dave McCoy ()
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, mo... |
// ***************************************************************************
// ***************************************************************************
// 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; char a[103], b[103], c[103]; char aa[103], bb[103], cc[103]; char temp[103]; int temp2; char ss[602]; char s[602]; int n; int main() { scanf( %s%s%s , aa, bb, cc); scanf( %d , &n); int i, j, jj; int coun1 = 0, coun2 = 0, coun3 = 0; for ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; long long ans = 0; for (int i = (0); i < (n); ++i) { long long t, T, x, cost; cin >> t >> T >> x >> cost; if (t >= T) { ans += cost + m * x; continue; } long long aux1 = ... |
/*
Copyright (c) 2015-2016 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() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; cin >> s; for (int i = 0; i < s.length(); i++) { if (s[i] == W && s[i + 1] == U && s[i + 2] == B ) { s.erase(i, 3); i--; cout << ;... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017
// Date : Fri Oct 27 00:02:33 2017
// Host : Juice-Laptop running 64-bit major relea... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline bool cmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; } template <typename T> inline bool cmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; } int read() { int x = 0, f = 1; char ch; for (ch = getchar(... |
/*
* 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 Francis Bruno, All Rights Reserved
//
// 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... |
/*
* Copyright (c) 1999-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... |
#include <bits/stdc++.h> int dr[] = {2, 2, -2, -2, 1, -1, 1, -1}; int dc[] = {1, -1, 1, -1, 2, 2, -2, -2}; int dr1[] = {0, 0, 1, 1, 1, -1, -1, -1}; int dc1[] = {1, -1, 1, 0, -1, 0, 1, -1}; int dr2[] = {0, 0, 1, -1}; int dc2[] = {1, -1, 0, 0}; using namespace std; long long a[100005]; long long bigmod(... |
#include <bits/stdc++.h> using namespace std; const int N = 2005; struct poke { double p, q; } srt[N]; inline bool cmp1(poke a, poke b) { return a.p > b.p || a.p == b.p && a.q > b.q; } inline bool cmp2(poke a, poke b) { return a.p - a.p * a.q > b.p - b.p * b.q; } double f[N]; int n, a, b; do... |
module lsu_opcode_decoder(
lsu_selected,
lsu_opcode,
issue_source_reg1,
issue_source_reg2,
issue_source_reg3,
issue_mem_sgpr,
sgpr_source1_rd_en,
sgpr_source2_rd_en,
sgpr_source1_addr,
sgpr_source2_addr,
vgpr_source2_rd_en,
vgpr_source1_addr,
... |
/////////////////////////////////////////////////////////////
// Created by: Synopsys DC Ultra(TM) in wire load mode
// Version : L-2016.03-SP3
// Date : Sun Nov 20 02:50:49 2016
/////////////////////////////////////////////////////////////
module GDA_St_N16_M4_P4 ( in1, in2, res );
input [15:0] in1;
input... |
#include <bits/stdc++.h> using namespace std; int num[5005]; int rmq(int l, int r) { int ans = 1 << 30, tmp = l; for (int i = l; i <= r; i++) { if (ans > num[i]) { ans = num[i]; tmp = i; } } return tmp; } int get(int l, int r, int h) { if (l > r) return 0; i... |
// 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 : Tue Jun 06 02:48:32 2017
// Host : GILAMONSTER running 64-bit major release (... |
//-----------------------------------------------------------------------------------------
//-- txchar: Uart_tx example 1
//-- Continuous transmission of a character when the DTR signal is activated
//-- The reset signal is connected to the dtr signal (in file txchar.pcf)
//-- Fot this example to work is necessary to ... |
#include <bits/stdc++.h> using namespace std; const long long inf = 12345678987654321ll; long long dp[3000]; int n; int main() { cin >> n; int t, c; for (int i = 1; i <= n; i++) dp[i] = inf; for (int i = 1; i <= n; i++) { cin >> t >> c; ++t; for (int i = n + t; i > n; i--) { ... |
#include <bits/stdc++.h> using namespace std; long long two(int x) { return 1LL << x; } int get(long long p, int i) { return (p >> (i - 1)) & 1; } long long count(int n, int k, long long pre) { long long ret = 0; bool rev = true, inv = true; for (int i = 1; i + i <= n; i++) { if (i <= k && n -... |
//-----------------------------------------------
// This is the simplest form of inferring the
// simple/SRL(16/32)CE in a Xilinx FPGA.
//-----------------------------------------------
`timescale 1ns / 100ps
`default_nettype none
(* DowngradeIPIdentifiedWarnings="yes" *)
module axi_protocol_converter_v2_1_7_b2s_sim... |
//////////////////////////////////////////////////////////////////
// //
// Wishbone Slave to Xilinx MCB (DDR3 controller) Bridge //
// //
// This file is part of the Amber project ... |
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize( O2 ) #pragma GCC optimize( unroll-loops ) struct POINT { int x, y; POINT() : x(0), y(0) {} POINT(int x, int y) : x(x), y(y) {} POINT operator+(const POINT &t) const { return POINT(x + t.x, y + t.y); } POINT operator-(const P... |
module HaarFilter_tb ();
parameter STAGES = 8;
parameter INTERNAL_WIDTH = 18;
parameter IN_WIDTH = 16;
parameter OUT_WIDTH = 16;
reg clk; ///< System clock
reg rst; ///< Reset, synchronous and active high
reg en; ... |
// Put your file header here
//
`ifndef TESTSIZE
`define TESTSIZE 78
`endif
module stimulus;
reg [9:0] test_vector [`TESTSIZE-1:0];
parameter period = 20;
parameter delay = 2;
// declare the signals here
reg clk, rst_n, push, pop;
reg [7:0] datain;
wire empty, almost_empty, full, almost_full, error;
wire [7:... |
#include <bits/stdc++.h> using namespace std; int32_t main() { ios::sync_with_stdio(0); int64_t n, m, d; cin >> n >> m >> d; vector<pair<int64_t, int64_t> > a1(n), a2(m); for (auto &e : a1) { cin >> e.first >> e.second; e.second = -e.second; } for (auto &e : a2) { cin >... |
#include <bits/stdc++.h> #pragma GCC target( avx2 ) #pragma GCC optimization( O3 ) #pragma GCC optimization( unroll-loops ) #pragma GCC optimize( Ofast ) #pragma GCC target( avx,avx2,fma ) using namespace std; long long binpow(long long base, long long exp, int mod) { long long res = 1; while (exp... |
module a23_gc_main
#(
// mem size in words (32bit)
parameter CODE_MEM_SIZE = 64 , //Code: 0x00000000
parameter G_MEM_SIZE = 64 , //AdrGarbler: 0x01000000
parameter E_MEM_SIZE = 64 , //AdrEvaluator: 0x02000000
parameter OUT_MEM_SIZE = 64 , //AdrOut: 0x03000000
parameter STACK_ME... |
#include <bits/stdc++.h> using namespace std; const long long INF = numeric_limits<long long>::max() / 4; struct MinCostMaxFlow { int N; vector<vector<long long> > cap, flow, cost; vector<int> found; vector<long long> dist, pi, width; vector<pair<int, int> > dad; MinCostMaxFlow(int N) ... |
//-----------------------------------------------------------------------------
//
// (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
... |
#include <bits/stdc++.h> using namespace std; int n, m; int a, b, t, p; int Pow(int x, int a) { int ret = 1; while (a) { if (a & 1) ret = ret * 1ll * x % 1000000007; a >>= 1, x = x * 1ll * x % 1000000007; } return ret; } int pr[200006]; int J[200006], iJ[200006]; int C(int a,... |
//+FHDR------------------------------------------------------------------------
//Copyright (c) 2013 Latin Group American Integhrated Circuit, Inc. All rights reserved
//GLADIC Open Source RTL
//-----------------------------------------------------------------------------
//FILE NAME :
//DEPARTMENT : IC Design / Veri... |
#include <bits/stdc++.h> using namespace std; template <class T1, class T2> inline istream& operator>>(istream& fin, pair<T1, T2>& pr) { fin >> pr.first >> pr.second; return fin; } template <class T0, class T1, class T2> inline istream& operator>>(istream& fin, tuple<T0, T1, T2>& t) { fin >> get... |
/**
* 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... |
`define ADDER_WIDTH 020
`define DUMMY_WIDTH 128
`define 3_LEVEL_ADDER
module adder_tree_top (
clk,
isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0, isum0_1_0_1, isum0_1_1_0, isum0_1_1_1,
sum,
);
input clk;
input [`ADDER_WIDTH+0-1:0] isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0,... |
`include "../mem_ctl.v"
module test;
reg read_n,
write_n,
ce_n,
clk;
reg [6:0] address_bus;
wire [7:0] data_bus;
wire [7:0] mem_data;
wire [16:0] mem_address;
wire ceh_n;
wire ce2;
wire we_n;
wire oe_n;
mem_ctl mem1(r... |
#include <bits/stdc++.h> using namespace std; const int MAX = int(1e9 + 5); const long long MAXL = long long(1e18 + 5); const long long MOD = long long(1e9 + 7); const long long MOD2 = long long(998244353); void fastio() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); return; ... |
#include <bits/stdc++.h> long long n; int main() { scanf( %lld , &n); printf( %lld n , n - n / 2 - n / 3 - n / 5 - n / 7 + n / 6 + n / 10 + n / 14 + n / 15 + n / 21 + n / 35 - n / 30 - n / 42 - n / 70 - n / 105 + n / 210); } |
#include <bits/stdc++.h> using namespace std; struct linearbasis { long long base[64], flag, cnt; bool add(long long x) { for (int i = 62; ~i; i--) { if (x >> i & 1) { if (!base[i]) { base[i] = x; return false; } x ^= base[i]; } ... |
// file: clk_wiz_0.v
//
// (c) Copyright 2008 - 2013 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is not a ... |
#include <bits/stdc++.h> const int N = 100100; const long long mod = 1e9 + 7; using namespace std; int n, Xa, Ya, Xb, Yb; int Smallest(int a, int b, int c, int d) { int min_ = a; if (min_ > b) min_ = b; if (min_ > c) min_ = c; if (min_ > d) min_ = d; return min_; } int main() { ios... |
// (C) 2001-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 associated doc... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; struct Node { int a[3], idx; bool operator<(const Node& ano) const { if (a[1] == ano.a[1]) { if (a[2] == ano.a[2]) return a[0] < ano.a[0]; return a[2] < ano.a[2]; } return a[1] < ano.a[1]; } } t[N... |
// God put a smile upon your face <3 #include <bits/stdc++.h> #define slld(longvalue) scanf( %lld , &longvalue) #define ll long long #define ull unsigned long long #define pll pair < long long, long long > #define fastio ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0) #define pb ... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2009-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
... |
/**
* 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... |
// -*- verilog -*-
//
// USRP - Universal Software Radio Peripheral
//
// Copyright (C) 2007 Corgan Enterprises LLC
//
// 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... |
#include <bits/stdc++.h> using namespace std; vector<long long> gaps(1e5 + 1); int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; long long t; cin >> t; while (t--) { long long a, b, c, n; cin >> a >> b >> c; n = (abs(b - a)) * 2; long lon... |
// megafunction wizard: %RAM: 2-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: COMMAND_PAGE.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// =======================... |
/*#pragma GCC optimize( O3 ) #pragma GCC target( avx,avx2,fma ) #pragma GCC optimize( unroll-loops )*/ #include<bits/stdc++.h> using namespace std; #define CIN ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define ll long long int #define pb push_back #de... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; long long t; cin >> n >> t; vector<long long> a, b; for (long long i = 0; i < n; i++) { long long x; cin >> x; x += t; a.push_back(x); } vector<int> breaks; bool poss = true; long long... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:167772160 ) using namespace std; int main() { int n; cin >> n; pair<int, int> x[1111]; for (int i = 0; i < n; ++i) cin >> x[i].first >> x[i].second; long long p = 0, maxx = -1; int j = 0; for (int i = 0; i < x[n - 1].first; 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 la... |
module wr_port_40x64b_8_to_1 (
select,
port0_wr_en,
port0_wr_addr,
port0_wr_data,
port1_wr_en,
port1_wr_addr,
port1_wr_data,
port2_wr_en,
port2_wr_addr,
port2_wr_data,
port3_wr_en,
port3_wr_addr,
port3_wr_data,
port4_wr_en,
port4_wr_addr,
port4_wr_data,
port5_wr_... |
/**
* 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) 2002 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)
* ... |
/*
-- ============================================================================
-- FILE NAME : uart_rx.v
-- DESCRIPTION : UARTóMW
[
-- ----------------------------------------------------------------------------
-- Revision Date Coding_by Comment
-- 1.0.0 2011/06/27 suito VKì¬
-- ======... |
/*
* 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... |
module counter_test;
localparam WIDTH=5;
reg clk ;
reg rst ;
reg load ;
reg enab ;
reg [WIDTH-1:0] cnt_in;
wire [WIDTH-1:0] cnt_out;
counter
#(
.WIDTH ( WIDTH )
)
counter_inst
(
.clk ( clk ),
.rst ( rst ),
.load ( load ),
.enab ( enab... |
#include <bits/stdc++.h> using namespace std; char a[500000 + 10]; int n, t; int mh; int h, s; int go(int mid) { int num = mid; int cnt = 0; int en = mh; int last; if (mid < h) { int u = 0; for (int i = 0; i < n; i++) { if (a[i] == S ) { u++; if (... |
#include <bits/stdc++.h> using namespace std; struct SegmentTree { int l, r, val, lazy; } t[800005]; int n, q, a[200005]; void build(int l, int r, int p) { t[p].l = l; t[p].r = r; if (l == r) { t[p].val = a[l]; return; } int mid = (l + r) >> 1; build(l, mid, p << 1); ... |
// ZX-Evo Base Configuration (c) NedoPC 2008,2009,2010,2011,2012,2013,2014,2019
//
// fpga SPI slave device -- AVR controlled.
/*
This file is part of ZX-Evo Base Configuration firmware.
ZX-Evo Base Configuration firmware is free software:
you can redistribute it and/or modify it under the terms of
th... |
//*****************************************************************************
// (c) Copyright 2008 - 2010 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
/... |
/*
* Copyright (c) 2000 Nadim Shaikli <>
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* ... |
#include <bits/stdc++.h> using namespace std; const long long int INF = 1e18, N = 2e6 + 3, BASE = 130; int main() { long long int n, k; cin >> n >> k; vector<int> arr(n), up(n); for (int i = 0; i < n; i++) { cin >> arr[i]; } for (int i = n - 2; i >= 0; i--) { if (arr[i + 1] == ... |
//Legal Notice: (C)2018 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... |
module block_ld_checker
import bsg_cache_non_blocking_pkg::*;
#(parameter `BSG_INV_PARAM(data_width_p)
, parameter `BSG_INV_PARAM(id_width_p)
, parameter `BSG_INV_PARAM(addr_width_p)
, parameter `BSG_INV_PARAM(block_size_in_words_p)
, parameter `BSG_INV_PARAM(cache_pkt_width_lp)
, parameter `BSG... |
#include <bits/stdc++.h> using namespace std; long long n, ans; vector<long long> a; int main() { cin >> n; a.resize(n); long long min_A = 1 << 31 - 1; long long max_A = -1; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] > max_A) { max_A = a[i]; } if (a[i... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, i, mi, ma, x; cin >> n; int m[n + 1]; for (i = 1; i <= n; i++) { cin >> x; m[x] = i; } int a[n + 1]; a[1] = 1; a[n] = 1; mi = m[1]; ... |
#include <bits/stdc++.h> using namespace std; long long read() { long long x = 0, f = 1; char ch; while (!isdigit(ch = getchar())) (ch == - ) && (f = -f); for (x = ch ^ 48; isdigit(ch = getchar()); x = (x << 3) + (x << 1) + (ch ^ 48)) ; return x * f; } const long long N = 2e5... |
/**
* 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 = 1e5 + 10; const int INF = 0x3f3f3f3f; const double PI = acos(-1.0); const double eps = 1e-10; const int M = 1e9 + 7; int dcmp(double first) { if (fabs(first) < eps) return 0; return first < 0 ? -1 : 1; } int a[N]; int main() { i... |
#include <bits/stdc++.h> using namespace std; int entries[1010000][2]; long long has[1010000]; long long power[1010000]; int main() { int i, j; long long ans = 0; int n, m, u, v, p = 31; scanf( %d%d , &n, &m); power[0] = 1; for (i = 1; i <= n; i++) power[i] = power[i - 1] * p; for ... |
`include "defines.v"
module ex(
//input
//EX
input wire[31:0] insAddr_i,
input wire[4:0] aluOp_i,
input wire[31:0] operand1_i,
input wire[31:0] operand2_i,
//MEM
input wire[31:0] storeData_i,
input wire[2:0] memOp_i,
//WB
input wire[4:0] writeRegAddr_i,
input wire writeReg_i,
input wire wr... |
#include <bits/stdc++.h> using namespace std; template <typename T> void write(ostream& out, T t) { out << t << n ; } template <typename T, typename... Args> void write(ostream& out, T t, Args... args) { out << t << ; write(out, args...); } template <typename... Args> void debug(Args.... |
/*
* 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... |
`timescale 1 ns / 1 ps
module Eight_Digit_Seven_Segment_Display_v2_0 #
(
// Users to add parameters here
// User parameters ends
// Do not modify the parameters beyond this line
// Parameters of Axi Slave Bus Interface S00_AXI
parameter integer C_S00_AXI_DATA_WIDTH = 32,
parameter integer C_S00_AXI_A... |
#include <bits/stdc++.h> using namespace std; int *s; int fenzhi(int left, int right, int d) { int mins = 0x3f3f3f3f; ; for (int i = left; i <= right; i++) mins = min(mins, s[i] - d); int ans = 0; for (int i = left; i <= right; i++) if (s[i] > mins + d) { int j = i; while... |
#include <bits/stdc++.h> using namespace std; int n, m; int main() { cin >> n >> m; cout << min(n, m) + 1 << endl; for (int i = 0; i < min(n, m) + 1; i++) { cout << i << << min(n, m) - i << endl; } return 0; } |
//% @file sdm_adc_data_aggregator.v
//% @brief Aggregate external ADC and TMS_SDM data to send through aurora.
//% @author Yuan Mei
//%
//% The rate of ADC and TMS_SDM data words must be of fixed ratio relation.
//% @param[in] NCH_ADC total number of external ADC channels
//% @param[in] ADC_CYC # of CLK cycles per ADC ... |
#include <bits/stdc++.h> using namespace std; const long long maxn = 123; long long a[maxn], b[maxn], n, m; char s[maxn]; long long vis[20], t[20], sb[maxn]; void dfs(long long stp, long long sa) { if (sa > sb[stp + 1]) return; if (stp == 0) { cout << sa << endl; exit(0); } if (s... |
#include <bits/stdc++.h> using namespace std; const long long maxn = 100010; const long long inf = 1e9 + 7; long long n, a[maxn]; long long minv = inf; long long sum[3]; int main() { scanf( %I64d , &n); for (long long i = 1; i <= n; i++) { scanf( %I64d , &a[i]); minv = min(minv, a[i]);... |
// megafunction wizard: %ROM: 1-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: prn5ccc.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ============================... |
#include <bits/stdc++.h> using namespace std; template <typename T1, typename T2> inline bool umin(T1& x, const T2& y) { return x > y ? x = y, true : false; } template <typename T1, typename T2> inline bool umax(T1& x, const T2& y) { return x < y ? x = y, true : false; } const int N = (int)5e2 +... |
//Legal Notice: (C)2010 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... |
/**
* 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; template <typename T> T gcd(T x, T y) { if (x < y) swap(x, y); while (y > 0) { T f = x % y; x = y; y = f; } return x; } template <typename T> pair<T, T> exgcd(T x, T y) { if (x < y) swap(x, y); pair<T, T> r = make_pair(1... |
//--------------------------------------------------------------------------------
// Project : SWITCH
// File : rx_engine.v
// Version : 0.1
// Author : Vipin.K
//
// Description: 64 bit PCIe transaction layer receive unit
//
//---------------------------------------------------------------------------... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, p = 0; cin >> n >> m; if (n == 1 && m != 0) { cout << m << << m << endl; return 0; } else if (m == 1 && n != 0) { cout << n << << n << endl; return 0; } else if (n == 0 && m == 0) { cout <<... |
#include <bits/stdc++.h> using namespace std; const long long M = 7e2 + 5; const long long mod = 1e9 + 7; char sz[M]; long long a[M], js; inline long long read() { register long long x = 0, y = 1; register char c = getchar(); while (!isdigit(c)) { if (c == - ) y = 0; c = getchar(); ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.