text stringlengths 59 71.4k |
|---|
// This module explicitly instantiates a chain of 1 to 4 SRL32s along with
// required MUXF7s and MUX8.
module srl32_chain_seg #
(
parameter N = 1, // Numbers of SRL32s in chain (from 1 to 4!)
parameter SITE = "" // Site to LOC all bels to
)
(
input wire CLK,
input wire CE,
input wire D,
i... |
#include <bits/stdc++.h> using namespace std; using ll = long long; template <class T> void chkmin(T &x, const T &y) { if (y < x) { x = y; } } template <class T> void chkmax(T &x, const T &y) { if (y > x) { x = y; } } template <class T> void sort(vector<T> &a) { sort(... |
#include <bits/stdc++.h> using namespace std; int a, b, c, d; void solve() { double m = max((3.0) * a / (10.0), (double)(a - a * c / 250)); double v = max((3.0) * b / (10.0), (double)(b - b * d / 250)); if (m > v) cout << Misha << endl; if (m == v) cout << Tie << endl; if (m < v) cout << ... |
#include <bits/stdc++.h> using namespace std; int read() { int X = 0, w = 1; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) w = -1; c = getchar(); } while (c >= 0 && c <= 9 ) X = X * 10 + c - 0 , c = getchar(); return X * w; } const int N = 100000 + 10; ... |
/**
* 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 s[65] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1,... |
#include <bits/stdc++.h> using namespace std; long long int n, u, a[300001], x, y; long double ans = -1.0; int main() { cin >> n >> u; for (int i = 0; i < n; ++i) cin >> a[i]; y = 1; while (x < n - 2) { while (y < n - 1 && a[y + 1] - a[x] <= u) ++y; if (y - x >= 2 && a[y] - a[x] <= u... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const long long inf = 1e18; const long double eps = 1e-8; const double pi = acos(-1); const long long hashh = 247; char s[203040]; long long p[203040], cnt[203040], hs[203040][2]; long long get(long long l, long long r) { ... |
/**
* 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 std::bitset; using std::cin; using std::cout; using std::endl; using std::make_pair; using std::map; using std::pair; using std::priority_queue; using std::queue; using std::set; using std::string; using std::stringstream; using std::vector; class MyTimer { ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, ar[100010], flag = 1, cnt = 1; char s[100010]; scanf( %d , &n); getchar(); for (int i = 1; i <= n; i++) scanf( %c , &s[i]); for (int i = 1; i <= n; i++) scanf( %d , &ar[i]); for (int i = 1; i <= n; i++) { if (s[cnt] ... |
/**
* 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 = 0x3f3f3f3f; struct Rec { pair<int, int> interval[4]; } recs[100005]; bool check(set<pair<pair<int, int>, int>> st[]) { int n = st[0].size(); if (n == 1) return true; set<pair<pair<int, int>, int>>::iterator iter[4]; for (int i =... |
#include <bits/stdc++.h> using namespace std; void solve(); int main() { ios::sync_with_stdio(0); solve(); return 0; } int a[1000001]; void solve() { int n, m; cin >> n >> m; for (int i = 0; i < n; ++i) { int v; cin >> v; a[v]++; } for (int i = 0; i < m; ++i... |
#include <bits/stdc++.h> using namespace std; const int mod = 1000000007; const vector<int> mods = {998244353, 1000000007, 1000000009}; const long long inf = 3e18; const double pi = acos(-1.0); const double eps = 0.0000001; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); template <c... |
#include <bits/stdc++.h> using namespace std; int v, e; vector<int> out[30005]; vector<int> ans; bool vis[30005]; void dfstree(int n) { for (auto x : out[n]) { if (!vis[x]) { vis[x] = true; dfstree(x); } } ans.push_back(n); } int main() { cin >> v >> e; fo... |
#include <bits/stdc++.h> using namespace std; long long dp[2][52][52][52][52] = {{{{{0}}}}}; int d[52]; int n; const int MOD = 1e9 + 7; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i = 0; i < n; ++i) { cin >> d[i]; } dp[1][d[0] == 2][d[0] == 3][d[1] == 2... |
// XXX Icarus can't handle parameters being use in the header
`timescale 1ns/10ps
module simpledpram(clock,
wraddress, wrdata, wren,
rdaddress, rddata);
parameter DATA_WIDTH = 32;
parameter ADDR_WIDTH = 7;
parameter INIT_FILE = "somefile.mif";
parameter OFFSET = 0;
... |
/*
Copyright (c) 2014-2018 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 a[1050], b[1050]; int main() { int n, m, s = 0, d = 0; cin >> n >> m; for (int i = 0; i < m; i++) { cin >> a[i]; b[i] = a[i]; } for (int i = 1; i <= n; i++) { sort(a, a + m); for (int j = 0; j < m; j++) { if (a[j... |
#include <bits/stdc++.h> using namespace std; inline void read(int &x) { x = 0; int f = 1; char c = getchar(); while (c > 9 || c < 0 ) { if (c == - ) f = -1; c = getchar(); } while (c >= 0 && c <= 9 ) x = (x << 1) + (x << 3) + (c ^ 48), c = getchar(); x *= f; }... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const int N = 2e5 + 5; const int SZ = 1e6 + 5; const long long INF = 2e9 + 5; int n, m, p; pair<int, long long> a[N], b[N]; pair<int, pair<int, long long> > mon[N]; long long tree[4 * SZ], lazy[4 * SZ], cost[SZ]; void Build... |
#include <bits/stdc++.h> using namespace std; int main() { int num, hight, temp, width = 0; cin >> num >> hight; vector<int> v; for (int i = 0; i < num; i++) { cin >> temp; v.push_back(temp); if (v[i] > hight) width += 2; else width++; } cout << width;... |
/**
* 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 = 21, inf = 1e7; int n, k, a[1 << N], pre[1 << N], ns, cs[1 << N]; inline int cmax(int x, int y) { if (x == -1 || y == -1) return x == -1 ? y : x; return a[x] > a[y] ? x : y; } bool E[1 << N][N]; void UPD(int x) { cs[x] = -1; for (i... |
#include <bits/stdc++.h> using namespace std; const int maxn = 210; const double eps = 1e-9; int n; int lsh[maxn * 2], ln, K; map<int, int> mt; int To[maxn]; int li[maxn], ri[maxn]; double f[2][maxn][maxn]; double ans[maxn][maxn]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) ... |
#include <bits/stdc++.h> using namespace std; int n, m; vector<vector<int> > D; int main(int argc, char **argv) { cin >> n >> m; for (int i = 0; i < n; i++) { string t; cin >> t; D.push_back(vector<int>()); for (int j = 0; j < m; j++) { D[D.size() - 1].push_back(t[j] == ... |
/*
* 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() { long long n, k, i; while (scanf( %lld%lld , &n, &k) != EOF) { long long a[k + 1]; vector<pair<long long, long long> > v; for (i = 0; i < k; i++) { cin >> a[i], v.push_back(make_pair((n % a[i]), i + 1)); } sort(v... |
#include <bits/stdc++.h> using namespace std; const unsigned int tb[32] = {13, 0, 27, 1, 28, 18, 23, 2, 29, 21, 19, 12, 24, 9, 14, 3, 30, 26, 17, 22, 20, 11, 8, 13, 25, 16, 10, 7, 15, 6, 5, 4}; int n, m, tot; priority_queue<long long, std::v... |
#include <bits/stdc++.h> using namespace std; template <class T> ostream& prnt(ostream& out, T v) { out << v.size() << n ; for (auto e : v) out << e << ; return out; } template <class T> ostream& operator<<(ostream& out, vector<T> v) { return prnt(out, v); } template <class T> ost... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100500; const int infi = (1 << 30); const long long infl = (1LL << 62); const double eps = 1e-9; const long long mod = 1000000007LL; const double pi = acos(-1.0); int n, k; int a[maxn], c[maxn]; int main() { cin >> n >> k; for (i... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: pc_muxsel_mon.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... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of ent_bb
//
// Generated
// by: wig
// on: Fri Jul 15 16:37:20 2005
// cmd: h:/work/eclipse/mix/mix_0.pl -strip -nodelta ../../sigport.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
// ... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; const int inf = 1e9; int n, m; int mp[3][N]; char ch[N]; struct node { int d1, d2, d3, d4; }; struct tree { int l, r; node d; } t[N * 5]; node merge(node a, node b) { node tmp; tmp.d1 = min(inf, min(a.d1 + b.d... |
#include <bits/stdc++.h> using namespace std; int n, m, q, cnt, ans, w[13][100010], bi[20], g[13][100010], tot; bitset<4096> f[2 * 100010]; int main() { int i, s, a, b, j, k; for (i = bi[0] = 1; i < 20; i++) bi[i] = bi[i - 1] << 1; scanf( %d%d%d , &n, &m, &q); tot = m; for (i = 1; i <= m; i+... |
#include <bits/stdc++.h> using namespace std; int c[100010]; long long ans; int main() { int n, x; scanf( %d%d , &n, &x); for (int i = 1; i <= n; i++) scanf( %d , &c[i]); sort(c + 1, c + n + 1); if (n < x) { ans = 0; for (int i = 1; i <= n; i++) ans += (long long)c[i] * (x - i + ... |
module test();
reg a, b;
wire a1, a2, a3, a4, a5, a6, a7;
assign (supply1, supply0) a1 = a;
tran t1(a1, a2);
tran t2(a2, a3);
tran t3(a3, a4);
tran t4(a4, a5);
tran t5(a5, a6);
tran t6(a6, a7);
wire a11, a12, a13, a14, a15, b11, b12, b13, b14, b15;
wire a21, a22, a23, a24, a25, b21, b22, b23, b24, b25;
wire a31, a... |
/////////////////////////////////////////////////////////////////////
//// ////
//// Non-restoring unsinged divider ////
//// ////
//// Author: Richard Herveille ... |
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(0); cin.tie(NULL); long long int T; cin >> T; while (T--) { long long int n; cin >> n; long long int a[n]; for (long long int i = 0; i < n; i++) cin >> a[i]; if (a[n - 1] > a[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; const long long M = 1000000007; const double pi = acos(-1); const int N = 2e5 + 10; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); ; long long n, k, m, d, q = 1, ans = 0; cin >> n >> k >> m >> d; for (long lon... |
#include <bits/stdc++.h> using namespace std; int main() { int t, n, a[55], b[55], i, amin, bmin; long long int sum; scanf( %d , &t); while (t--) { scanf( %d , &n); amin = 0x3f3f3f3f; for (i = 0; i < n; i++) { scanf( %d , &a[i]); if (amin > a[i]) amin = a[i]; ... |
// $Id: tcnode_wrap.v 1661 2009-11-02 05:01:21Z dub $
/*
Copyright (c) 2007-2009, 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:
Redistributions of so... |
/**
* 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
module test();
reg clock, reset;
sopc sopc(
.clock(clock),
.reset(reset)
);
always #1 clock = ~clock;
initial begin
$dumpfile("dump.vcd");
$dumpvars;
$dumpvars(0, sopc.cpu.register.storage[1]);
$readmemh("rom.txt", sopc.rom.sto... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 3e5 + 10; int n; set<pair<pair<int, int>, int> > a; int ans[MAXN]; inline pair<pair<int, int>, int> mpi(int a, int b, int c) { return make_pair(make_pair(a, b), c); } void exit() { cout << Impossible ; exit(0); } int main() ... |
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << : << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, ... |
// megafunction wizard: %ROM: 1-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: ADC_ROM.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ============================... |
#include <bits/stdc++.h> using namespace std; int n, m; bool flag[21][21]; int deg[21], id[21]; vector<int> G[21]; inline int cmp(int x, int y) { return deg[x] != deg[y] ? deg[x] < deg[y] : x < y; } bool vis[21]; inline void dfs(int np) { vis[np] = 1; for (int &x : G[np]) { if (!vis[... |
// Double buffering with dual-port RAM
// Uses dual-port RAM to write switches to one section, while reading another to control LEDs.
// Flip SW0 to swap the buffers.
module top (
input clk,
input [15:0] sw,
output [15:0] led,
// not used
input rx,
outpu... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); ; long long t; cin >> t; while (t--) { long long n, x, m; cin >> n >> x >> m; long long c, d; long long l = x, r = x; while (m--) { cin >> c >> d; ... |
`include "constants.vh"
`default_nettype none
module rrf_freelistmanager
(
input wire clk,
input wire reset,
input wire invalid1,
input wire invalid2,
input wire [1:0] comnum,
input wire prmiss,
input wire [`RRF_SEL-1:0] rrftagfix,
output wire [`... |
#include <bits/stdc++.h> using namespace std; inline int read() { int res = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == - ) f = -f; ch = getchar(); } while (isdigit(ch)) { res = (res << 1) + (res << 3) + (ch ^ 48); ch = getchar(); } return res... |
#include <bits/stdc++.h> using namespace std; typedef struct _lap { int p; int qu; } lap; bool cmp(const lap &a, const lap &b) { return a.p < b.p; } void remain() { int n; cin >> n; vector<lap> laps; for (int i = 0; i < n; ++i) { lap x; cin >> x.p >> x.qu; laps.push_b... |
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { cin.tie(0); cin.sync_with_stdio(0); int n; cin >> n; vector<string> a(2 * n - 2); map<string, vector<int>> m; for (int i = 0; i < 2 * n - 2; ++i) { cin >> a[i]; m[a[i]].emplace_back(i); } ... |
#include <bits/stdc++.h> using namespace std; struct node { int x, num; } s[100009]; int mark[100009]; int cmp(node a, node b) { return a.x < b.x; } int main() { int n, m; while (scanf( %d %d , &n, &m) == 2) { int l, h; scanf( %d %d , &l, &h); for (int i = 0; i < n; i++) { ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; typedef long long ll; typedef unsigned long long ull; template <typename T> bool umax(T& a, const T& b) { return b <= a ? false : (a = b, true); } template <typename T> bool umin(T& a, const T& b) { return b >= a ? false... |
// Accellera Standard V2.3 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2008. All rights reserved.
`include "std_ovl_defines.h"
`module ovl_fifo_index (clock, reset, enable, push, pop, fire);
parameter severity_level = `OVL_SEVERITY_DEFAULT;
parameter depth = 1;
param... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; const double EPS = 1e-8; const int mod = 1e9 + 7; const int N = 1e6 + 10; const long long INF = 1e18; long long power(long long x, long long y) { long long t = 1; while (y > 0) { if (y % 2) y -= 1, t = t * x % m... |
//
// Generated by Bluespec Compiler, version 2019.05.beta2 (build a88bf40db, 2019-05-24)
//
//
//
//
// Ports:
// Name I/O size props
// client_request_get O 77 reg
// RDY_client_request_get O 1 reg
// RDY_client_response_put O 1 reg
// RDY_server_request_... |
#include <bits/stdc++.h> using namespace std; using ll = long long; struct dreapta { ll a, b; ll operator()(ll x) { return a * x + b; } }; bool useless(dreapta a, dreapta b, dreapta c) { assert(a.a >= b.a && b.a >= c.a); return (double)(b.b - a.b) / (a.a - b.a) > (double)(c.b - b.b) / (b.a - c... |
#include <bits/stdc++.h> using namespace std; int get(int l, int n) { int v1, v2; cout << ? << l << endl; fflush(stdout); cin >> v1; cout << ? << (l + n / 2 - 1) % n + 1 << endl; fflush(stdout); cin >> v2; return v2 - v1; } int main() { int n; cin >> n; int l, r... |
#include <bits/stdc++.h> using namespace std; int a[100001], p[100001]; int main() { int min = 1000, sum = 0, n, i, j; scanf( %d , &n); for (i = 0; i < n; i++) { scanf( %d %d , &a[i], &p[i]); if (p[i] < min) { min = p[i]; } sum += a[i] * min; } printf( %d n , su... |
#include <bits/stdc++.h> using namespace std; const int inf = 109; const int mod = 1000000007; long long cnt[inf]; long long dp[inf]; long long temp[inf][inf]; long long sol[inf][inf]; long long bs[inf][inf]; int main() { int n, x, a; scanf( %d%d , &n, &x); for (int i = 0; i < n; ++i) { ... |
#include <bits/stdc++.h> #pragma GCC target( avx2 ) #pragma GCC optimization( O3 ) #pragma GCC optimization( unroll-loops ) using namespace std; inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; } inline int msbp(int x) { return 31 - __builtin_clz(x); } inline int msb(int x) { return 1 << ms... |
//`timescale 1ns
module tb_fir ();
initial begin
$read_lib_saif("../saif/NangateOpenCellLibrary.saif");
$set_gate_level_monitoring("on");
$set_toggle_region(UUT);
$toggle_start;
end
wire CLK_i;
wire RST_n_i;
wire [8:0] DIN_i;
wire VIN_i;
//wire [15:0] H0_i;
//wire [15:0]... |
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2014.4 (lin64) Build Tue Nov 18 16:48:31 MST 2014
// Date : Mon Feb 16 11:07:32 2015
// Host : austin_workstation_1 running 64-bit Fedora ... |
module zscale_wrapper (
input wire clk,
input wire reset,
output wire [7:0] led
);
wire csr_resp_valid;
wire [63:0] csr_resp_data;
// BootMem AHB
wire [31:0] io_bootmem_haddr;
wire io_bootmem_hwrite;
w... |
#include <bits/stdc++.h> int main() { char a[110], b[110]; scanf( %s%s , a, b); if (strcmp(a, b) == 0) printf( %s n , a); else printf( 1 n ); } |
// (c) Copyright 1995-2017 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is not a license and does not grant ... |
#include <bits/stdc++.h> using namespace std; inline int read() { char c = getchar(); int x = 0; bool f = 0; for (; !isdigit(c); c = getchar()) f ^= !(c ^ 45); for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48); if (f) x = -x; return x; } const int M = 4e6 + 10; i... |
////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2012, Ameer M. Abdelhadi; . All rights reserved. //
// //
// Redistribution and use in source and binary forms, with or with... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5; vector<int> graph[N]; int pa[N]; int getHeight(int u, int pre) { int res = 1; pa[u] = pre; for (auto e : graph[u]) { if (e == pre) { continue; } int subHeight = getHeight(e, u); res = max(res, subHeigh... |
#include <bits/stdc++.h> using namespace std; int n; struct edge { int v, next; } e[500100]; int head[100100], tot = 0; void Add(int u, int v) { e[tot].v = v; e[tot].next = head[u]; head[u] = tot++; } int res[100100]; int deep[100100]; int vis[100100]; void DFS(int u) { vis[u] ... |
#include <bits/stdc++.h> using namespace std; int n, k, b[1000010]; int main() { scanf( %d%d , &n, &k); int i; if (k * 3 > n || k == 1) puts( -1 ); else { for (i = 1; i <= (int)(k); ++i) b[i] = b[i + 2 * k] = i, b[i + k] = i - 1; b[k + 1] = k; for (i = 3 * k + 1; i <= n; ++... |
#include <bits/stdc++.h> using namespace std; const long long MM = 10000000000000001; int n; long long a[200005]; int rs[200005]; long long lazy[4 * 200005]; pair<long long, int> it[4 * 200005]; pair<long long, int> minp(pair<long long, int> A, pair<long long, int> B) { if (A.first < B.first) return... |
#include <bits/stdc++.h> using namespace std; long long ans = 0; int n; long long a[200200]; long long mn = 21000000000; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; mn = min(mn, a[i]); } int id; for (int i = n - 1; i >= 0; i--) { if (a[i] == mn) { ... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; if ((n - 2) % 3 == 0) { cout << 1 << << 2 << << n - 3 << endl; } else { cout << 1 << << 1 << << n - 2 << endl; ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps / 1ps
`include "utils/bus_to_ip.v"
`include "seq_gen/seq_gen.v"
`include "se... |
module uvm;
class simple_item extends uvm_sequence_item;
rand int unsigned addr;
rand int unsigned data;
rand int unsigned delay;
constraint c1 { addr < 16'h2000; }
constraint c2 { data < 16'h1000; }
// UVM automation macros for general objects
`uvm_object_utils_begin(simple_item)
a = b;
... |
#include <bits/stdc++.h> using namespace std; long long a, b, k, t, maxi, l, r, i, ans; long long dp0[200005]; long long dp1[200005]; long long s[200005]; int main() { cin >> a >> b >> k >> t; maxi = k * t; dp1[maxi] = 1; while (t) { t--; for (i = 0; i <= 2 * maxi; i++) { ... |
//UART Version 3
/*
Distributed under the MIT license.
Copyright (c) 2014 Cospan Design LLC
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 ri... |
module axis_control_if
#(
parameter C_S_AXIS_RXS_TDATA_WIDTH = 32,
parameter C_M_AXIS_TXC_TDATA_WIDTH = 32,
parameter ENABLE_LEN = 1
)
(
// Ports of Axi Master Bus Interface m_axis
input m_axis_txd_tvalid,
input m_axis_txd_tlast,
input m_axis_txd_tready,
input [... |
module user_io(
input SPI_CLK,
input SPI_SS_IO,
output reg SPI_MISO,
input SPI_MOSI,
input [7:0] CORE_TYPE,
output [7:0] JOY0,
output [7:0] JOY1,
output [2:0] MOUSE_BUTTONS,
output KBD_MOUSE_STROBE,
output KMS_LEVEL,
output [1:0] KBD_MOUSE_TYPE,
outp... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; int n, m; pair<int, int> tl = {-100, -100}, br = {-100, -100}; cin >> n >> m; char paper[n][m]; for (int i = 0; i < n; i++) { for (int j = 0; j < m;... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, k; cin >> n >> k; long long a; int g = 0; for (int i = 0; i < n; i++) { cin >> a; set<int> d; while (a) { if (a % 10 <= k) { d.insert(a % 10); ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 15:58:18 03/26/2016
// Design Name:
// Module Name: addr_gen
// Project Name:
// Target Devices:
// Tool versions:
// Description:µØÖ·²úÉúÆ÷£¬ÔÚ¼Æ... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n, m, k; long long zero = 0; cin >> n >> m >> k; long long x, s; cin >> x >> s; long long a[m], b[m], c[k], d[k]; long lon... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:256000000 ) const long long INF = 1e9; const long long mod = 1e9 + 7; const long long LINF = 1e14; using namespace std; long long n, l; vector<long long> c; vector<int> b; int main() { std::ios::sync_with_stdio(false); cin >> n >> l; ... |
#include <bits/stdc++.h> using namespace std; vector<int> a[10005]; int main() { int n, x, k = 0; cin >> n; x = (sqrt(1.0 + 8 * n) + 1) / 2; cout << x << endl; for (int i = 1; i <= x; i++) for (int j = i + 1; j <= x; j++) a[i].push_back(++k), a[j].push_back(k); for (int i = 1; i <= x... |
#include <bits/stdc++.h> using namespace std; const int MAX = 1e5 + 10; const double eps = 1e-6; int n, m; int sum, res; int f[21][1 << 21], col[MAX]; char s[MAX]; int main() { scanf( %d%d , &n, &m); for (int i = 0; i < n; i++) { scanf( %s , s); for (int j = 0; j < m; j++) if... |
/*
* 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... |
/* ****************************************************************************
-- (C) Copyright 2018 Kevin M. Hubbard - All rights reserved.
-- Source file: deep_sump_hyperram.v
-- Date: July 2018
-- Author: khubbard
-- Description: Deep Sump extension to sump2.v logic analyzer. This uses a FIFO
-- ... |
/*
* Copyright 2015, Stephen A. Rodgers. 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 Foundation; either version 2 of the License, or
* (at your option) any later ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 300009; map<short, int> f[maxn]; int a[maxn], n, K, p, q, d; int sum[maxn], i, j, k; int main() { scanf( %d%d , &n, &K); d = n / K; for (i = 1; i <= n; i++) scanf( %d , &a[i]); sort(a + 1, a + n + 1); for (i = 2; i <= n; i++)... |
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 5; const int INF = 0x3f3f3f3f; int arr[N]; int dq[N * 2]; int main() { int n; scanf( %d , &n); int dl = N, dr = N - 1; for (int i = 0; i < n; i++) { scanf( %d , &arr[i]); if (arr[i] == 1) { dr++; dq... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.