text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { long long tmp; while (b) { a %= b; tmp = a; a = b; b = tmp; } return a; } int main() { int n; cin >> n; vector<int> a(n + 1, 0); for (int i = 0; i < n; i++) { cin... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const int eps = -1e6; const int MAX = 200010; long long int n, k, x; long long int a[MAX], pre[MAX], s[MAX]; long long int expo(long long int a, long long int b) { long long int x = 1, y = a; while (b > 0) { if (b & 1) x ... |
#include <bits/stdc++.h> using namespace std; struct Query { int id, left, right, time, blockLeft, blockRight; Query() : id(-1), left(-1), right(-1), time(-1), blockLeft(-1), blockRight(-1) {} Query(int id, int left, int right, int time, int blockLeft, int blockRight) : id(id), ... |
// This is the first part of a two-part test that checks that the argument to
// a $signed or $unsigned function is treated as a self-determined expression.
// This part performs tests where the argument is unsigned.
module pr2922063a;
reg [3:0] op1;
reg [2:0] op2;
reg [7:0] result;
reg fail;
task check_result... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 23:38:58 12/01/2015
// Design Name: peripheral_crc_7
// Module Name: /home/jorge/Documentos/SPI_SD/crc_7_peripheral_testbench.v
// Project Name: SPI_SD
// Target Dev... |
// (C) 2001-2015 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated doc... |
#include <bits/stdc++.h> using namespace std; vector<char> v; string s; int main() { cin >> s; for (int i = 0; i < s.size(); i++) { if (!v.empty() && v.back() == s[i]) v.pop_back(); else v.push_back(s[i]); } cout << (v.empty() ? Yes : No ); } |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 17:36:58 05/16/2015
// Design Name:
// Module Name: IO_memory
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 03/15/2016 12:05:10 PM
// Design Name:
// Module Name: Full_Adder_PG
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
// ... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 1e5 + 5; char a[MAX_N]; int main() { int N; cin >> N; scanf( %s , a + 1); int cnt = 0; for (int i = 1; i <= N; i++) { if (a[i] == S && a[i] >= 2 && a[i - 1] == G ) { cnt++; } } if (a[N] == G ) cnt... |
// vga.v
// This file was auto-generated as part of a generation operation.
// If you edit it your changes will probably be lost.
`timescale 1 ps / 1 ps
module vga (
input wire iCLK, // clk.clk
output wire [9:0] VGA_R, // avalon_slave_0_export.export
output wire [9:0] VGA_G,... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:100000000 ) using namespace std; int n; string s; string A[] = { 123456 , 154236 , 145326 , 516324 , 261453 , 132546 }; string B[] = { 123456 , 523164 , 623541 , 423615 }; vector<string> P; vector<string> T; vector<string> H; bool BB[1... |
#include <bits/stdc++.h> using namespace std; priority_queue<pair<int, int>, vector<pair<int, int> >, greater<pair<int, int> > > que; stringstream ssin; const long long LINF = 0x7fffffffffffffffll; const int N = 4e5 + 5, M = 4e5 + 5, mod = 1e9 + 7, INF = 0x3f3f3f3f; int n, idx, sum; ... |
#include <bits/stdc++.h> const int N = 1e5 + 5; const unsigned long long bigN = 1e18; const long long mod9 = 1e9 + 9; const long long mod7 = 1e9 + 7; using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); vector<int> a, b; int n, l, r, x; cin >> n >> l >> r; for ... |
//#############################################################################
//# Function: 6:1 one hot mux #
//#############################################################################
//# Author: Andreas Olofsson #
... |
/*******************************************************************************
* 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; int main() { ios_base::sync_with_stdio(0); long long x, y, m; cin >> x >> y >> m; if (x <= 0 && y <= 0) { if (max(x, y) >= m) cout << 0 ; else cout << -1 ; return 0; } if (x > y) swap(x, y); long long odp =... |
#include <bits/stdc++.h> using namespace std; inline long long Getint() { char ch = getchar(); long long x = 0, fh = 1; while (ch < 0 || ch > 9 ) { if (ch == - ) fh = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { (x *= 10) += ch ^ 48; 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 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 n, m, x, y, k, T, p[300], a[300][300]; void dfs(int i) { for (int j = 0; j <= n; j++) if (a[i][j]) { a[i][j] = a[j][i] = 0; p[i]--; p[j]--; if (j && i) cout << j << << i << endl; dfs(j); } } int... |
#include <bits/stdc++.h> using namespace std; struct point { long long int x, y; point() {} point(long long int _x, long long int _y) { x = _x; y = _y; } }; bool cmp(const point &a, const point &b) { if (a.x == b.x) return a.y < b.y; return a.x < b.x; } struct freq { ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2009 by Iztok Jeras.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
localparam NO = 7; // number of access events
// packed structures
struct packed {
... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1000020; const int maxx = 1000000; const int MOd = 1e9 + 7; const int K = 1000; const int P = 143; int loc[maxn]; class Aho_Corasick { public: int last, next[maxn][26]; short used[maxn][26], step; int deg[maxn], dad[maxn]; ... |
#include <bits/stdc++.h> using namespace std; int dx[4] = {0, -1, 0, 1}; int dy[4] = {1, 0, -1, 0}; int x[100000], y[100000], DP[100000], CP[100000], R, C, used[50][50][4][4]; char s[64][64]; bool Out(int xx, int yy) { return xx < 0 || yy < 0 || xx >= R || yy >= C; } void next(int x1, int y1, int DP1, int... |
#include <bits/stdc++.h> #include <iomanip> // std::setprecision #define ll long long const long modulo=1000000007; using namespace std; int ctoi(char c) {return c- 0 ;} int compare(pair <int,pair<int,int>> one, pair <int,pair<int,int>> two){ if(one.first<two.first) return 1;... |
#include <bits/stdc++.h> using namespace std; int read() { int x; scanf( %d , &x); return x; } const int N = 1123456; int a[N]; vector<int> v[N]; int c[N]; priority_queue<int> q[N]; void dfs(int x, int t) { c[x] = t; q[t].push(a[x]); for (int i = 0; i < v[x].size(); i++) { ... |
#include <bits/stdc++.h> using namespace std; bool st[1000000]; int main() { int N, K; cin >> N >> K; for (int i = 0; i < 1000000; i++) st[i] = false; int cnt = 0; for (int i = 0; i < N; i++) { int te1, te2; cin >> te1 >> te2; te1 += 100000, te2 += 100000; for (int j = ... |
/*
Copyright (c) 2015 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,... |
/****************************************************************************
AddSub unit
- Should perform ADD, ADDU, SUBU, SUB, SLT, SLTU
is_slt signext addsub
op[2] op[1] op[0] | Operation
0 0 0 0 SUBU
2 0 1 0 SUB
1 0 0 1 ADDU
3 ... |
#include <bits/stdc++.h> using namespace std; template <class T> inline T checkmin(T &a, T b) { return (a < b) ? a : a = b; } template <class T> inline T checkmax(T &a, T b) { return (a > b) ? a : a = b; } template <class T> T GCD(T a, T b) { if (a < 0) return GCD(-a, b); if (b < 0) re... |
#include <bits/stdc++.h> using namespace std; inline long long read() { long long s = 0, w = 1; register char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) w = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) s = (s << 3) + (s << 1) + (ch ^ 48), ch = getchar... |
#include <bits/stdc++.h> using namespace std; int binary_search(vector<int> a, int korol) { if (a[a.size() - 1] < korol) return a.size() - 1; if (a[0] > korol) return -1; int max = a.size() - 1, min = 0, mid; if (min + max >= 0) mid = (int)((min + max) / 2); else mid = (int)((min + m... |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: bg1_new.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ================================... |
/**
* 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 NMax = 110000; const long long INF = 4294967296LL; int N, sum[NMax]; char A[NMax]; int S[NMax], L; unsigned int dp[3][NMax]; int main() { scanf( %d %s , &N, A); if (N & 1) { puts( 0 ); return 0; } int cur = 1, cnt = 0; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x1, y1, x2, y2; scanf( %d%d%d%d%d%d , &n, &m, &x1, &y1, &x2, &y2); int x, y; x = abs(x1 - x2); y = abs(y1 - y2); if (x > y) swap(x, y); if (y < 4) { cout << First << endl; return 0; } if (x < 3 && ... |
#include <bits/stdc++.h> using namespace std; int str2int(string s) { istringstream ss(s); int t; ss >> t; return t; } int main() { string s; cin >> s; int ans = -1; for (int i = 1; i < s.length(); i++) { string s1 = s.substr(0, i); if (s1.length() > 1 && s1[0] == 0 ... |
#include <bits/stdc++.h> using namespace std; using vi = vector<int>; using vvi = vector<vi>; using ll = long long; using vll = vector<ll>; using vvll = vector<vll>; using pii = pair<int, int>; using pll = pair<ll, ll>; void solve() { int n; cin >> n; vi a(n), b(n); vector<pii> p, q; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int arr[10] = {0}; char S[100001]; cin >> S; for (int i = 0; S[i]; i++) { int j = 0; if (S[i] == L ) { while (arr[j] == 1) j++; arr[j] = 1; } j = 10 - 1; if (S[i] == R ... |
#include <bits/stdc++.h> const long long mod = 1000000000; class V { public: long long a[2]; V(long long a0 = 0, long long a1 = 0) { a[0] = a0 % mod; a[1] = a1 % mod; } V operator+(const V &v) { return V(a[0] + v.a[0], a[1] + v.a[1]); } }; class M { public: long long a[2][2... |
`timescale 1ns/1ps
//**********************************************************************
// File: check_pin.v
// Module:check_pin
// by Robin zhang
//**********************************************************************
module check_pin(
clk,rst_n,tx_start,capture_ready,tx_data,tx_complete,tx_end,bps_start_t,recei... |
/***************************************************************************************************
** fpga_nes/hw/src/cpu/apu/apu_div.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 th... |
#include <bits/stdc++.h> typedef struct { double x, y; } point_t; typedef struct { double x, y, r; } circle_t; typedef struct { double A, B, C; } Line; Line zhong_chui_xian(circle_t circle1, circle_t circle2) { Line L1; point_t p; double k; p.x = (circle1.x + circle2.x) / 2; ... |
// 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;
// verilator lint_off COMBDLY
// veri... |
// Copyright (c) 2000-2009 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, pub... |
#include <bits/stdc++.h> int Set(int N, int pos) { return N = N | (1 << pos); } int reSet(int N, int pos) { return N = N & ~(1 << pos); } bool check(int N, int pos) { return (bool)(N & (1 << pos)); } using namespace std; string s; int n; bool dp[10010][4], taken[10010][4]; bool isSafe(int pos, int l1) {... |
//
// Copyright (c) 1999 Steven Wilson ()
//
// 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)
// ... |
/**
* 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... |
// Calculates a CRC32 (Ethernet, polynomial 0x04C11DB7).
//
module CRC32 (
input clk,
input reset,
input rx_we,
input [7:0] rx_byte,
output reg [31:0] tx_crc = 32'd0
);
localparam [31:0] poly = 32'b0000_0100_1100_0001_0001_1101_1011_0111;
wire [31:0] crc = reset ? 32'd0 : tx_crc;
wire [7:0] byt... |
/*
* This program is explicitly placed in the public domain for any uses
* whatsoever.
*/
module TestMultiplier();
reg clk;
initial begin
clk = 0;
forever #0.5 clk = ~clk;
end
reg[5:0] left, right;
wire[2:0] exp;
Multiplier mul(clk, left, right, exp);
parameter ONE = {3'b011, 3'b0}; // 1.00... |
#include<bits/stdc++.h> using namespace std; long long ans; int d[100005]; int main(){ int t; cin>>t; while(t--){ int n; scanf( %d ,&n); for(int i=1;i<=n;++i)scanf( %d ,&d[i]); sort(d+1,d+1+n); ans=d[n]; for(int i=1;i<=n;++i)ans+=d[i]*(n+1ll-i-i); printf( %lld n ,ans); } } |
`timescale 1 ns / 1 ps
`include "AXIOutputRegisters_v1_0_tb_include.vh"
// lite_response Type Defines
`define RESPONSE_OKAY 2'b00
`define RESPONSE_EXOKAY 2'b01
`define RESP_BUS_WIDTH 2
`define BURST_TYPE_INCR 2'b01
`define BURST_TYPE_WRAP 2'b10
// AMBA AXI4 Lite Range Constants
`define S00_AXI_MAX_BURST_LENGTH 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; map<char, long long> mp; map<pair<char, long long>, long long> cnt; int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); for (char c = a ; c <= z ; c++) cin >> mp[c]; string s; cin >> s; long long n = s.length(); long long sum = m... |
#include <bits/stdc++.h> using namespace std; const int N = 1000005; long long fac[N], dp[N]; int mod = 1000000007; long long pow(int a, int b, int MOD) { long long x = 1, y = a; while (b > 0) { if (b % 2 == 1) { x = (x * y); if (x > MOD) x %= MOD; } y = (y * y); ... |
#include <bits/stdc++.h> using namespace std; char buf[1 << 21], *p1 = buf, *p2 = buf; template <class T> void read(T &x) { x = 0; int c = getchar(); int flag = 0; while (c < 0 || c > 9 ) flag |= (c == - ), c = getchar(); while (c >= 0 && c <= 9 ) x = (x << 3) + (x << 1) + (c ^ ... |
// frame_decoder.v
`timescale 1 ns / 1 ps
module frame_detector
(
input clk400,
input clk80,
input reset,
input enable,
input sdata,
output reg [4:0]pdata,
output reg error
);
reg [5:0]s; // shift register
reg detect; // 000001 pattern detected
reg [2:0]c; // frame pos counter
wire... |
#include <bits/stdc++.h> using namespace std; template <class TH> void _dbg(const char *sdbg, TH h) { cerr << sdbg << = << h << endl; } template <class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) { while (*sdbg != , ) cerr << *sdbg++; cerr << = << h << , ; _dbg(sdbg + 1... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100005, mod = 1e9 + 7; inline int Add(int x, int y) { return (x += y) >= mod ? x - mod : x; } int n, cnt[maxn], vec[maxn], tot; int main() { scanf( %d , &n); cnt[0] = 1; for (int i = 1, x; i <= n; ++i) { scanf( %d , &x), tot = 0;... |
#include <bits/stdc++.h> using namespace std; set<string> st; const int N = 1e6 + 5; int a[3000]; int c1 = 0, c2; string s, c; int na, nb, m, ans = 0, mx = 0; int main() { int n, a, b; cin >> n; while (n--) { cin >> a >> b; if (a == 2) { cout << b / a << endl; con... |
// 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 : Sun Jun 04 00:43:50 2017
// Host : GILAMONSTER running 64-bit major release (... |
//-------------------------------------------------------------------
//-- Test para arranque del tipo "warm boot" en la iCE40HX.
//-- Pulsando el botón 1 cambiamos el valor de la imagen a cargar.
//-- Pulsando el botón 2 generamos la señal "boot" para cargar dicha
//-- imagen.
//--------------------------------... |
#include <bits/stdc++.h> using namespace std; int a[20], b[20]; char s[110000]; int main() { int n, i, j; scanf( %s , s); for (i = 0; s[i]; i++) { if (s[i] == 5 ) a[2]++; else if (s[i] == 9 ) a[6]++; else a[s[i] - 0 ]++; } scanf( %s , s); for ... |
/*
* 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 Vec { double x, y; Vec(double newX = 0, double newY = 0) { x = newX; y = newY; } Vec operator+(Vec r) { return Vec(x + r.x, y + r.y); } Vec operator-(Vec r) { return Vec(x - r.x, y - r.y); } Vec operator*(double r) { return Vec... |
/**
* 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... |
//Legal Notice: (C)2006 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... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.3 (win64) Build Mon Oct 10 19:07:27 MDT 2016
// Date : Mon Oct 30 13:48:23 2017
// Host : vldmr-PC running 64-bit Service Pack 1 ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 08/28/2016 01:49:26 AM
// Design Name:
// Module Name: KOA_2
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revi... |
// $Id: whr_op_ctrl_mac.v 5188 2012-08-30 00:31:31Z dub $
/*
Copyright (c) 2007-2012, Trustees of The Leland Stanford Junior University
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributi... |
/*
* 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; map<string, int> f, reff; int n, m, q, w[13], ans[4097][101]; string s; string tob(int x) { string t = ; while (x > 0) { x % 2 == 0 ? t = 0 + t : t = 1 + t; x /= 2; } while (t.length() < n) { t = 0 + t; } return t;... |
// 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
// Methods defined by IEEE:
// function int unsigned $urandom [ (int seed ) ] ;
// function int uns... |
#include <bits/stdc++.h> using namespace std; const int maxm = 1e5 + 5; const int maxn = 1e5 + 5; const int inf = 0x3f3f3f3f; int n, m; int a[maxn]; struct edge { int u, v, w, next; } e[maxm * 2]; int head[maxn]; bool vis[maxn]; int cnt; priority_queue<int, vector<int>, greater<int> > q; v... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; struct cate { long long num, t; bool operator<(const cate& other) const { return t > other.t; } } a[maxn]; int n; set<long long> has; map<long long, long long> fa; long long find(long long x) { return x == fa[x] ? x : fa[x] ... |
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > vec; void update() { int x; scanf( %d , &x); vector<pair<int, int> > a, b; a.push_back({1000010, 0}); b.push_back({1000010, 0}); a.push_back({0, 0}); b.push_back({0, 0}); int sz = vec.size(); for (int i = 0; ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; using vi = vector<int>; using vll = vector<long long>; using vvll = vector<vll>; using vpii = vector<pair<int, int> >; using vpll = vector<pair<long long, long long> >; using vld = vector<long double>; using vb = vector<bool>; const int inf = (int)1e9 + 7;... |
`include "assert.vh"
module cpu_tb();
reg clk = 0;
//
// ROM
//
localparam MEM_ADDR = 4;
localparam MEM_EXTRA = 4;
reg [ MEM_ADDR :0] mem_addr;
reg [ MEM_EXTRA-1:0] mem_extra;
reg [ MEM_ADDR :0] rom_lower_bound = 0;
reg [ MEM_ADDR :0] rom_upper_bound = ~0;
wire [2... |
#include <bits/stdc++.h> using namespace std; int solve() { int n; cin >> n; if (n == 1) cout << 1 << endl; else { cout << n << ; for (int i = 1; i <= n - 1; ++i) cout << i << ; cout << n ; } return 0; } int main() { ios_base::sync_with_stdio(false); ... |
/**
* 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) 2010 by Terasic Technologies Inc.
// ============================================================================
//
// Permission:
//
// Terasic grants permission to use and modify this code for use
// in synth... |
///////////////////////////////////////////////////////////////////////////////
//
// 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... |
// 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
class Base;
endclass
class BasedA extends Base;
endclass
class BasedB extends Base;
endclass
module t (/*... |
#include <bits/stdc++.h> using namespace std; long long a1, a2, b1, b2, c1, c2; int main() { ios_base::sync_with_stdio(0); cin.tie(); cout.tie(); cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2; if (!a1 && !b1 && c1 || !a2 && !b2 && c2) { cout << 0 ; return 0; } if (a1 * b2 != a2 ... |
#include <bits/stdc++.h> using namespace std; int n, k, a[5001], b[1000001], d[1000001]; void doc() { for (int i = 1; i <= n; i++) cin >> a[i]; } void xuli() { sort(a + 1, a + n + 1); for (int i = 1; i < n; i++) for (int j = i + 1; j <= n; j++) d[a[j] - a[i]]++; int m = 0; while (tru... |
module game_text_top_ya
(
input wire clk, reset,
input wire [1:0] btn,
// we use the button now to control the FSM
output wire hsync, vsync,
output wire [2:0] rgb
);
// symbolic state declaration
// you may use one-hot if you wish
localparam [1:0]
newgame = 2'b00,
// dis... |
#include <bits/stdc++.h> using namespace std; int main() { int N, i, sum = 0, max; cin >> N; int A[N]; for (i = 0; i <= N - 1; i++) cin >> A[i]; max = *max_element(A, A + N); for (i = 0; i <= N - 1; i++) sum += (max - A[i]); cout << sum << endl; return 0; } |
//-----------------------------------------------------------------------------
// File : wishbone_bus.v
// Creation date : 06.04.2017
// Creation time : 11:52:40
// Description : Bus used to connect one wishbone master to multiple slaves. Used slave is determined using the address output of the master and p... |
/*****************************************************************************
* *
* Module: Altera_UP_Audio_Out_Serializer *
* Description: *
... |
/**
* 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; int main() { string s; string ans; cin >> s; int i = 0; int j = 0; while (i < s.size() & j < 3) { if (j == 0) { if (s[i] == f ) { ans = ftp:// ; i = 3; } else { ans = http:// ; i = ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; int N = 1000001; vector<int> count(N); long long n; cin >> n; vector<long long> a(n), ans; long long sum = 0, i, j, k; for (i = 0; i < n; i++) cin >> a[i], ... |
#include <bits/stdc++.h> using namespace std; template <class A, class B> inline bool mina(A &first, B second) { return (first > second) ? (first = second, 1) : 0; } template <class A, class B> inline bool maxa(A &first, B second) { return (first < second) ? (first = second, 1) : 0; } const int ... |
// Copyright (C) 1991-2013 Altera Corporation
// Your use of Altera Corporation's design tools, logic functions
// and other software and tools, and its AMPP partner logic
// functions, and any output files from any of the foregoing
// (including device programming or simulation files), and any
// associated docume... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.