text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; template <typename S, typename T> ostream& operator<<(ostream& out, pair<S, T> const& p) { out << ( << p.first << , << p.second << ) ; return out; } template <typename T> ostream& operator<<(ostream& out, vector<T> const& v) { long long l = v.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 <bits/stdc++.h> const int N = 517; const int mod = 998244353; using namespace std; inline int read() { int x = 0; char ch = getchar(); while (!isdigit(ch)) ch = getchar(); while (isdigit(ch)) x = (x << 1) + (x << 3) + ch - 0 , ch = getchar(); return x; } int n, k; long long d... |
/**
* 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, a, matrica[101][101], pas = 0; cin >> n; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) { cin >> a; matrica[i][j] = a; } for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) { if (... |
#include <bits/stdc++.h> using namespace std; int nn, mm; struct Dinic { struct edge { int to, flow, cap; }; const static int N = 20007; vector<edge> e; vector<int> g[N + 7]; int dp[N + 7]; int ptr[N + 7]; void clear() { for (int i = 0; i < N + 7; i++) g[i].clear(); ... |
/*
File: ewrapper_link_receiver.v
This file is part of the Parallella FPGA Reference Design.
Copyright (C) 2013 Adapteva, Inc.
Contributed by Roman Trogan <>
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 Fr... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using pii = array<ll, 3>; vector<vector<pii>> adj; vi sz, parent; int fill(int cur, int par = -1) { parent[cur] = par; for (auto [v, _, __] : adj[cur]) if (v != par) sz[cur] += fill(v, cur); sz[cu... |
#include <bits/stdc++.h> using namespace std; struct ele { long long next, prev, delta, y; }; long long r, c, k, n, curcnt = 0, ans = 0; vector<ele> a; vector<long long> deltaleft, deltaright; vector<vector<long long> > X, id; vector<pair<long long, long long> > tmp; void init() { X.clear(); ... |
#include <bits/stdc++.h> #pragma Optimize( O3 ) using namespace std; int n, x, a, b, y, m, ans; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; vector<int> v(n); vector<int> a; for (int i = 0; i < n; i++) cin >> v[i]; for (int i = 0; i < n; i += 2) a.push_back(v[... |
// (C) 1992-2012 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 simul... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
module RAMB16_S1_S2 (
CLKA, CLKB, ENB, WEA, WEB,... |
#include <bits/stdc++.h> using namespace std; int INF = 1000000005; long long INFF = 1000000000000000005LL; int main() { long long s, n; cin >> s >> n; long long x, y; vector<pair<long long, long long>> strengths; for (long long i = 0; i < n; i++) { cin >> x >> y; strengths.push_... |
// file: Clk_Wizard.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 ... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
//////////////////////////////////////////////////////////////////////
//// ////
//// sm_fifoRTL.v ////
//// ////
//// This file is part of the spiMas... |
#include <bits/stdc++.h> using namespace std; const int h = 17, N = 1 << h; long long t[2 * N]; long long k; long long product(int a, int b) { if (a > b) return 1; if (a % 2 == 1) return (t[a] * product(a + 1, b)) % k; if (b % 2 == 0) return (t[b] * product(a, b - 1)) % k; return product(a / 2... |
#include <algorithm> #include <iostream> #include <climits> #include <iomanip> #include <cstring> #include <string> #include <vector> #include <queue> #include <cmath> #include <set> #include <map> using namespace std; template <typename T> istream &operator>> (istream &is, vector<T> &ve... |
// -*- verilog -*-
// Copyright (c) 2012 Ben Reynwar
// Released under MIT License (see LICENSE.txt)
// Connects a buffer_BB to a stage and an mstore and takes care of
// transfering data.
module buffer_BB_to_stage
#(
parameter N = 8,
parameter LOG_N = 3,
parameter WIDTH = 32,
parameter MWIDTH = 1
)
... |
module autotieoff_signed (/*AUTOARG*/);
/*AUTO_LISP(setq my-nc-output "\/*NC*\/" my-nc-input-scalar "1'b0" my-nc-input-vector "'0" my-nc-input-mdv "'{default:'0}" my-space "|")*/
/* sub AUTO_TEMPLATE (
.\(.*\) (@"(concat (if (equal vl-dir \\"output\\") my-nc-output (if (not vl-memory) my-nc-in... |
#include <bits/stdc++.h> using namespace std; long long totalSum; long long check(long long a, long long b, long long c, long long r) { if (b + c > a) { return 0; } long long d = min(r, a - b - c); return (d + 2) * (d + 1) / 2; } int main() { long long a, b, c, l, total; cin >> a... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2009-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 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 <iostream> #include <algorithm> #include<cmath> #include<cstring> #include<cstdio> #include<cstdlib> #include<vector> #include<iomanip> #include<ctime> #include<set> #include<map> #include<queue> #include<stack> #include<bitset> #define sqr(x) ((x)*(x)) #define fz1(i,n) for ((i)=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 law... |
`timescale 1ps / 1ps
module ADC_interface_AXI_test (
);
// HELPER
function integer clogb2;
input integer value;
integer i;
begin
clogb2 = 0;
for(i = 0; 2**i < value; i = i + 1)
clogb2 = i + 1;
end
endfunction
localparam tries = 4;
localparam sword = 32;
localparam impl = 0;
localparam sync... |
#include <bits/stdc++.h> using namespace std; int main() { int q, k; cin >> q; long long l, r, d, x; for (k = 0; k < q; ++k) { cin >> l >> r >> d; if (d < l || d > r) x = d; else { if (r % d == 0) x = r + d; else x = r + (d - (r % d)); ... |
#include <bits/stdc++.h> using namespace std; vector<bool> visited; vector<vector<int>> adj; vector<int> depth; void dfs(int v, int d) { if (visited[v]) { return; } visited[v] = true; depth[d]++; for (int i : adj[v]) { dfs(i, d + 1); } } int main() { int n; cin ... |
#include <bits/stdc++.h> using namespace std; char str[1010]; int pri[510][510]; int pre[510][510]; int f[510][510]; bool v[510] = {0}; int N; void init() { gets(str); scanf( %d , &N); } void prework() { int len = strlen(str); for (int i = 0; i < len; ++i) for (int j = 0; j < l... |
#include <bits/stdc++.h> using namespace std; set<int> s[400000]; int bl[400000], S[400000], sz, n, m; void dfs(int x, int y) { bl[x] = y; ++sz; for (int z : s[x]) if (z != 1 && !bl[z]) dfs(z, y); } void dft(int x) { S[x] = sz; for (int y : s[x]) if (y != 1 && !S[y]) dft(y); ... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
/* lab2_part6.v
*
* Copyright (c) 2014, Artem Tovbin <arty99 at gmail dot com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope tha... |
module I2C_AV_Config ( // Host Side
iCLK,
iRST_N,
// I2C Side
I2C_SCLK,
I2C_SDAT );
// Host Side
input iCLK;
input iRST_N;
// I2C Side
output I2C_SCLK;
inout I2C_SDAT;
// Internal Registers/Wires
reg [15:0] mI2C_CLK_DIV;
reg [23:0] mI2C_DATA;
reg mI2C_CTRL_CLK;
reg ... |
#include <bits/stdc++.h> using namespace std; const int dx[] = {0, 1, -1, 0, 0}; const int dy[] = {0, 0, 0, 1, -1}; struct MinCostMaxFlow { int head[20010], total; int next[1000010], aim[1000010], flow[1000010], cost[1000010]; int f[20010], from[20010], p[20010]; bool v[20010]; MinCostMaxFlo... |
/* ctrl_clk_xilinx.v */
/* 2012, */
module ctrl_clk_xilinx (
input wire inclk0,
output wire c0,
output wire c1,
output wire c2,
output wire locked
);
// internal wires
wire pll_50;
wire dll_50;
wire dll_100;
reg clk_25 = 0;
// pll
DCM #(
.CLKDV_DIVIDE(2.0), // Divide by: 1.5,2.0,2.5,3.0,3.5,4.0,4.5... |
#include <bits/stdc++.h> struct Candidate { std::vector<int> d; Candidate(std::vector<int> d_) { d = d_; std::sort(d.begin(), d.end()); std::reverse(d.begin(), d.end()); } inline bool operator<(const Candidate &rhs) { if (d[0] < 0 || rhs.d[0] < 0) return d[0] < rhs.d[0]; ... |
#include <bits/stdc++.h> std::vector<std::vector<int>> ad; std::vector<int> fm; std::vector<bool> tmp; int f(int x) { if (fm[x] >= 0) return fm[x]; for (int y : ad[x]) f(y); for (int y : ad[x]) tmp[fm[y]] = true; fm[x] = int(std::find(begin(tmp), end(tmp), false) - begin(tmp)); for (int y : ... |
#include <bits/stdc++.h> using namespace std; int main() { double x, y, a, b, t; while (cin >> a >> b) { int n; cin >> n; double p = 1e18; for (int i = 0; i < n; i++) { cin >> x >> y >> t; p = min(p, hypot((x - a), (y - b)) / t); } printf( %.20lf , p); ... |
// ==============================================================
// 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... |
/*
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 "timescale.v"
module fb_slave_counters (MRxClk, Reset, MRxDEqDataSoC,
StateIdle, StatePreamble, StateData, StateSlaveData, StateSlaveCrc, StateFrmCrc,
TotalNibCnt, NibCnt, SlaveCrcEnd, FrmCrcStateEnd, TxRamAddr, RxRamAddr, SlaveByteCntEq0, IncrementTotalN... |
// megafunction wizard: %RAM: 2-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: mem_1k.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// =====================... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer: Jafet Chaves Barrantes
//
// Create Date: 22:59:47 05/31/2016
// Design Name:
// Module Name: top_reloj_digital_v2.0
// Project Name:
// Target Devices:
// Tool versions:
// Des... |
#include <bits/stdc++.h> using namespace std; const int NMAX = 5e3; const double eps = 1e-14; double dp[NMAX + 5][NMAX + 5]; int n, k; double p[NMAX + 5]; double np[NMAX + 5]; int t[NMAX + 5]; int main() { scanf( %d %d , &n, &k); for (int i = 1; i <= n; i++) { int x; scanf( %d %d ,... |
#include <bits/stdc++.h> using namespace std; const int N = 2501; int dp[N][3], a[N << 1]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; memset(dp, 0x3f, sizeof(dp)); dp[0][0] = dp[1][1] = 0; for (int i = 2; i <= n; i++) for (int j = i + 1 >> 1; j; j--) { ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 3000 + 12; int p[maxn]; int Et[maxn]; int mark[maxn][maxn]; queue<pair<int, int> > act; void input(int n) { for (int i = 0; i < n; i++) cin >> p[i]; } void solve(int n, int k) { int sef = 0; bool yek = 0; for (int j = n - 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; int x[2000][10], y[2000][10]; double Ab(int x) { if (x >= 0) return x; return -x; }; double q(double x) { return x * x; }; double d(int i, int j) { double X, Y; if (x[i][0] == x[i][1] && y[j][0] == y[j][1]) { Y = min(Ab(y[i][0] - y[j][0]), ... |
#include <bits/stdc++.h> int T; int n, m; bool get() { char ch = getchar(); while (ch != O && ch != X ) ch = getchar(); return (ch == X ); } int map[21][21], con[4001][2], top, cnt[4001], head[401], nxt[100001], b[100001], k = 1, dis[4001], pre[4001]; char ans[41][41]; int q[4001], h... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 100001; int q, n; int d[MAXN], p[MAXN]; int main() { cin >> q; int small = 1 << 30; for (int i = 0; i < q; ++i) { cin >> d[i]; small = ((small) > (d[i]) ? (d[i]) : (small)); } cin >> n; for (int i = 0; i < n; ++... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 100500; int n, m; int a[30]; string s, t; char ans[5500]; void po_poryadky(int x) { for (int i = x; i < n; i++) { for (int j = 0; j < 30; j++) if (a[j]) { ans[i] = (char)( a + j); a[j]--; break;... |
#include<bits/stdc++.h> #define ll long long using namespace std; int x[100005]; int idx=0; int d[100005]; int main() { int t; cin>>t; while(t--){ int n; cin>>n; idx=0; for(int i=1;i<=n;i++){ scanf( %d ,&x[i]); } ... |
#include <bits/stdc++.h> using namespace std; typedef struct line { int k; int b; long double x; } line; bool com(line l1, line l2) { if (l1.x < l2.x) return true; else return false; } int main() { long long k, b, n, t; cin >> k >> b >> n >> t; long long x = 1; ... |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: Conversion_ROM.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// =========================... |
#include <bits/stdc++.h> using namespace std; int M, N, maxH[100009], d[100009]; void dfs(int nod) { if (nod >= (1 << N)) { maxH[nod] = 0; return; } int f1 = nod << 1, f2 = f1 | 1; dfs(f1), dfs(f2); maxH[nod] = max(maxH[f1] + d[f1], maxH[f2] + d[f2]); } int ans = 0; void solv... |
#include <bits/stdc++.h> using namespace std; long long int dp[50][50]; int m, n; int main() { for (int x = 0; x < 36; x++) { dp[0][x] = 1; } for (int x = 1; x < 36; x++) for (int y = 1; y < 36; y++) for (int z = 0; z < x; z++) { dp[x][y] += dp[z][y - 1] * dp[x - z - 1]... |
module pi2c (/*AUTOARG*/
// Outputs
i2c_sda_i, i2c_scl_i,
// Inouts
i2c_sda, i2c_scl,
// Inputs
i2c_sda_o, i2c_sda_t, i2c_scl_o, i2c_scl_t
);
parameter PORTABLE = 0;
input i2c_sda_o;
input i2c_sda_t;
output i2c_sda_i;
input i2c_scl_o;
input i2c_scl_t;
output i2c... |
#include <bits/stdc++.h> using namespace std; int a[100000], b[100000], n, i, x, y; int main() { cin >> n; for (i = 0; i < n; i++) { cin >> a[i]; b[i] = a[i]; } sort(b, b + n); for (i = 0; i < n; i++) { if (a[i] != b[i]) { x = i; break; } } for (... |
#include <bits/stdc++.h> using namespace std; string s; long long int dp[510][501]; long long int solve(long long int l, long long int r) { if (dp[l][r] != -1) { return dp[l][r]; } if (l > r) return 0; long long int a = 1 + solve(l + 1, r); for (long long int i = l + 1; i <= r; i++) { ... |
/*
* Copyright (c) 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)
* ... |
//////////////////////////////////////////////////////////////////////
//// ////
//// File name "ge_1000baseX_mdio.v" ////
//// ////
//// This file is part of the : ... |
module fifo(
clk,
reset,
wr_en,
rd_en,
wr_data,
rd_data,
not_full,
not_empty,
error
);
parameter DATA_WIDTH = 32;
parameter ADDR_WIDTH = 4;
localparam FIFO_SIZE = {1'b1, {(ADDR_WIDTH){1'b0}}};
input clk;
input reset;
input wr_en;
input rd_en;
input [DATA_WIDTH-1:0] wr_data;
output [DATA_WIDTH-1:0] rd_data;
... |
/* -------------------------------------------------------------------------------
* (C)2012 Korotkyi Ievgen
* National Technical University of Ukraine "Kiev Polytechnic Institute"
* -------------------------------------------------------------------------------
*
* *** NOT FOR SYNTHESIS ***
*
* Random Packet ... |
#include <bits/stdc++.h> using namespace std; int h[100010], res[100010]; int main() { int n, i; while (scanf( %d , &n) != EOF) { memset(h, 0, sizeof(h)); memset(res, 0, sizeof(res)); for (i = 1; i <= n; i++) { scanf( %d , &h[i]); } int temp = 0; for (i = 1; i <... |
#include <bits/stdc++.h> using namespace std; int n; vector<int> a; void printall(int x, int y, bool paren = false) { if (paren) printf( ( ); for (int i = x; i < y; i++) printf( %d-> , a[i]); printf( %d , a[y]); if (paren) printf( ) ); } int main() { scanf( %d , &n); a.resize(n); ... |
#include <bits/stdc++.h> using namespace std; int main() { set<char> deputi; vector<vector<char> > off; int m, n; char boss; cin >> n >> m >> boss; off.resize(n); for (int i = 0; i < n; i++) off[i].resize(m); for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) do { ... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2015(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are... |
#include <bits/stdc++.h> using namespace std; vector<long long> start_years; vector<long long> start_numbers; vector<long long> mods; void init() { long long start = 1989; start_years.resize(10); start_numbers.resize(10); mods.resize(10); start_years[0] = start; start_numbers[0] = 9; ... |
//////////////////////////////////////////////////////////////////////
//// ////
//// OR1200's DC TAG RAMs ////
//// ////
//// This file is part of the OpenR... |
/**
* 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 inf = 1e9; const int MOD = 1e6 + 3; const int N = 1e2 + 5; int n, wid, hei; long long f[N], phei[N]; struct matrix { long long a[N][N]; matrix() { memset(a, 0, sizeof(a)); } } base, cur; matrix operator*(matrix a, matrix b) { matrix a... |
#include <bits/stdc++.h> using namespace std; long long n, m, k; string s; int a[4][100]; vector<int> seq; vector<pair<int, int> > poseq; bool check() { for (int i = 0; i < n; i++) { if (a[1][i] != 0 || a[2][i] != 0) { return true; } } return false; } pair<int, int> nex... |
module test;
reg fail = 1'b0;
reg [3:0] in = 4'b0;
wire [3:0] bus;
wire [3:0] val;
assign (pull1, pull0) bus = in;
assign val = bus;
initial begin
// Check the initial value.
#1 if (val !== 4'b0) begin
$display("FAILED: initial value, got %b, expected 0000.", val);
fail = 1'b1;
en... |
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n; cin >> n; char c[n][n]; for (long long i = 0; i < n; i++) { for (long long j = 0; j < n; j++) { cin >> c[i][j]; } } bool re =... |
#include <bits/stdc++.h> using namespace std; int main() { int n; string t, s; cin >> n >> s; t = s; sort(s.begin(), s.end()); int ret = (1 << 21); for (int i = 0; i < s.length() + 1; i++) { int dif = 0; for (int i = 0; i < s.length(); i++) { if (t[i] != s[i]) dif++; ... |
/**
* 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 = 200005; int dr8[] = {0, 0, 1, -1, 1, 1, -1, -1}; int dc8[] = {1, -1, 0, 0, -1, 1, -1, 1}; int dr4[] = {0, 1, -1, 0}; int dc4[] = {1, 0, 0, -1}; int n; int a[N]; set<pair<int, int> > s; set<int> end_idx; int sz[N]; int main() { ios_b... |
#include <bits/stdc++.h> using namespace std; int getcom(pair<int, int> a, pair<int, int> b) { vector<int> all; all.push_back(a.first); all.push_back(a.second); all.push_back(b.first); all.push_back(b.second); sort(all.begin(), all.end()); int com = -1; for (int k = 1; k < 4; k++) { ... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 7; const int MOD = 1e9 + 7; const int MAXN = 1e6 + 3; struct Rcompare { bool operator()(pair<int, int> lhs, pair<int, int> rhs) { return lhs.first > rhs.first; } }; struct compare { bool operator()(pair<int, int> lhs, pa... |
#include <bits/stdc++.h> using namespace std; const int N = 100005; int main() { int n, k, m, t, i, c[N]; scanf( %d%d , &n, &k); int ans = 0; while (k--) { scanf( %d , &m); for (i = 0; i < m; i++) { scanf( %d , &c[i]); } if (c[0] == 1) { for (i = 0; i < m; i... |
// iverilog -y .. -o tb-DataPipe.vvp tb-DataPipe.v
// vvp tb-DataPipe.vvp
`timescale 1ns/1ns
module tb;
localparam W = 8;
localparam CYC = 10;
reg clk, rst;
reg idata_vld;
wire idata_rdy;
reg [W-1:0] idata;
wire odata_vld;
reg odata_rdy;
wire [W-1:0] odata;
DataPipe#(W) dut(cl... |
/**
* 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
/**
* YL-3 Interface (http://www.dx.com/p/diy8-x-seven-segment-displays-module-for-arduino-595-driver-250813#.VoG5SPkrKHs)
* Modules based on diver_74hc595.v from Crazy_Bingo
* CLK = Clock from FPGA (50 MHz - Mojo V3)
* nRST = reset (inverted)
* DATA = 8x8 (64 bits of the array)
* LOAD... |
//
// Designed by Qiang Wu
//
`timescale 1ns/1ps
`include "NF_2.1_defines.v"
`include "reg_defines_reference_router.v"
`include "registers.v"
module out_arbiter
(// --- data path interface
output [63:0] out_data,
output [7:0] out_ctrl,
output reg out_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... |
/*******************************************************************************
* This file is owned and controlled by Xilinx and must be used solely *
* for design, simulation, implementation and creation of design files *
* limited to Xilinx devices or technologies. Use with non-Xilinx ... |
#include <bits/stdc++.h> using namespace std; const int MAXS = 100000; inline long long get(long long n, long long ma, long long b) { return max(ma, (6 * n + b - 1) / b) * b; } int main() { long long n, a, b; cin >> n >> a >> b; if (a * b >= 6 * n) { cout << a * b << endl; cout << ... |
#include <bits/stdc++.h> using namespace std; long long N, M, K, ans; long long a[105][21005]; long long sum[105][21005]; long long tree[21005 * 8]; long long lazy[21005 * 8]; long long dp[21005 * 8]; void updLazy(long long x, long long l, long long r) { if (!lazy[x]) return; tree[x] += lazy[x];... |
#include <bits/stdc++.h> using namespace std; int n, temp; int first = -1, sec = -1; int ifirst = -1, isec = -1; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> temp; if (temp > first) { sec = first; isec = ifirst; first = temp; ifirst = i + 1; ... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.4
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1 ns / 1... |
/**
* This is written by Zhiyang Ong
* and Andrew Mattheisen
*/
`timescale 1ns/100ps
/**
* `timescale time_unit base / precision base
*
* -Specifies the time units and precision for delays:
* -time_unit is the amount of time a delay of 1 represents.
* The time unit must be 1 10 or 100
* -base is the time base... |
#include <bits/stdc++.h> using namespace std; const long long INF = 0x3f3f3f3f; const double PI = acos(-1.0); const double eps = 1e-10; const long long M = 1e9 + 7; const long long N = 1e5 + 5; signed main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long t; cin >> t;... |
#include <bits/stdc++.h> using namespace std; vector<int> v; int n, x, now; long long ans; char a[3]; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> a; if (a[0] == a ) { cin >> x; v.insert(lower_bound(v.begin(), v.end(), x), x); } if (a[0] == d... |
#include <bits/stdc++.h> using namespace std; map<int, int> Map; int n, m, i, j; long long ans; string s; int main() { cin >> n; for (i = 1; i <= n; i++) { cin >> s; m = s.size(); bool cnt[30]; for (j = 0; j < 26; j++) cnt[j] = 0; for (j = 0; j < m; j++) cnt[s[j] - a ]... |
#include <bits/stdc++.h> using namespace std; using namespace std::chrono; template <typename A> ostream &operator<<(ostream &cout, vector<A> const &v); template <typename A, typename B> ostream &operator<<(ostream &cout, pair<A, B> const &p) { return cout << ( << p.first << , << p.second << ) ; ... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: dram_async_edgelogic.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... |
#include <bits/stdc++.h> using namespace std; string s; int main() { int n, i, j, k, l, m; cin >> n; cin >> s; int cnt, ans; char c, c1, c2, c3; ans = 0; for (i = 0; i < n - 1; i++) { cnt = 0; if (s[i] == s[i + 1] && i < n - 1) { c = s[i]; while (s[i] == c) ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, d = 0; cin >> n >> a >> b; n = n - a; if (n <= b) { cout << n; } else { cout << b + 1; } return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { int n, x, y; cin >> n >> x >> y; int dif = y - x; int minb = 1e9; for (int i = 1; i * i <= dif; ++i) { if (dif... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: jbi_timer.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/or
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.