text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; long long n, l, r, ans = 0; bool kk(long long x, long long i) { if (x == 1) { if (i == 1) return 1; else return 0; } else { long long t = 1, g; while (t <= x) t *= 2; t--; g = t / 2; if (g + 1 == i) { ... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; vector<long long> v[100009], vv[100009]; long long vis[100009], dis[101][100001], ar[100001]; void bfs(long long k) { queue<long long> q; memset(vis, 0, sizeof(vis)); for (long long x : vv[k]) { q.push(x); vis... |
#include <bits/stdc++.h> using namespace std; const int _ = 1e5 + 7, P = 1e9 + 7; int N, A[_], prm[_], cprm, phi[_], cnt[_]; bool nprm[_]; vector<int> lst[_]; void sieve() { phi[1] = 1; for (int i = 2; i <= 1e5; ++i) { if (!nprm[i]) { prm[++cprm] = i; phi[i] = i - 1; } ... |
#include <bits/stdc++.h> using namespace std; int tree[4 * 200005], cs[200005], ar[200005]; struct dt { int b, e, h, id, res; } st[100005]; bool cmp1(dt x, dt y) { return x.b < y.b; } bool cmp2(dt x, dt y) { return x.id < y.id; } void update(int nd, int b, int e, int x, int v) { if (b > x || e < x... |
//
// Generated by Bluespec Compiler, version 2019.05.beta2 (build a88bf40db, 2019-05-24)
//
//
//
//
// Ports:
// Name I/O size props
// client_request_get O 70 reg
// RDY_client_request_get O 1 reg
// RDY_client_response_put O 1 reg
// RDY_server_request_... |
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2014.4 (lin64) Build Tue Nov 18 16:47:07 MST 2014
// Date : Fri May 6 14:51:06 2016
// Host : graviton running 64-bit Debian GNU/Linux 7.... |
// Local Variables:
// verilog-library-directories:("." "../../../")
// End:
module resource_table_tb ();
localparam CU_ID_WIDTH = 1;
localparam NUMBER_CU = 2;
localparam WG_SLOT_ID_WIDTH = 4;
localparam NUMBER_WG_SLOTS_PER_CU = 4;
localparam RES_ID_WIDTH = 4;
localparam NUMBER_RES_SLOTS = 16;... |
/*
* 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 read() { long long x = 0, F = 1; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) F = -1; c = getchar(); } while (c >= 0 && c <= 9 ) { x = x * 10 + c - 0 ; c = getchar(); } return x * F; }... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2014/12/30 14:01:45
// Design Name:
// Module Name: onetswitch_top
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
/... |
// Model a simple flip flop with synchronous reset
//
// Notes:
// - Omitting the rst from the sensitivity list makes the flop synchronous
//
// - rst must be prioritized in the condition check for the synthesis tool
// to infer the rst signal.
//
// Advantages:
// - Synchronous reset ensures that the reset occurs o... |
/**
* 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... |
// -- (c) Copyright 2008 - 2012 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> using namespace std; const int maxn = 1e5 + 10; char c[maxn]; long long mod = 1e9 + 7; long long ex(long long a, long long b) { a = a % mod; long long ans = 1; while (b) { if (b % 2 == 1) { ans = (ans * a) % mod; } a = (a * a) % mod; b = b /... |
// file: system_clk_wiz_0_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 ... |
#include <bits/stdc++.h> using namespace std; string a, b; int main() { cin >> a >> b; int l1 = a.size(); int l2 = b.size(); int maxx = 0; for (int i = 0; i < l1; ++i) { for (int j = i; j < l1; ++j) { int p = 0; for (int k = 0; k < i; ++k) { if (p < l2) { ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 10; const double pi = acos(-1.0); const long long mod = 1e9 + 7; int n, k; int a[MAXN], b[MAXN], z[MAXN], f[MAXN]; void solve() { scanf( %d %d , &n, &k); int t = 0; for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); ... |
#include <bits/stdc++.h> using namespace std; template <class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; } template <class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; } const long long maxn = 1000001, mod = 1e9 + 7; int main() { ios_base::sync_with_st... |
#include <bits/stdc++.h> using namespace std; int getint() { int x = 0; char c = getchar(); while (c < 0 || c > 9 ) c = getchar(); while (c >= 0 && c <= 9 ) x *= 10, x += (c - 0 ), c = getchar(); return x; } vector<pair<int, int> > v[2]; int n, a[2][10010]; void XOR(int i, int j, ... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: exu_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/or
//... |
#include <bits/stdc++.h> using namespace std; const int maxn = 40; long long int dp[maxn][maxn], P[maxn], par[maxn][maxn]; string s; int main() { ios_base::sync_with_stdio(false); cin.tie(0); P[0] = 1; for (int i = 1; i < maxn; i++) P[i] = P[i - 1] * 10; cin >> s >> s; for (int i = ((i... |
#include <bits/stdc++.h> using namespace std; long long int n, a, b; long long int S(long long int x) { int ret = 0; long long int y = n - x; while (x > 0) { ret += x % 10; x /= 10; } while (y > 0) { ret += y % 10; y /= 10; } return ret; } long long int solv... |
/**
* 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 LIMIT = 20; int n, dep[300001]; vector<int> adj[300001]; int dp[300001][LIMIT], dp2[300001][LIMIT]; void dfs(int x, int pre) { vector<int> child; for (auto y : adj[x]) { if (y != pre) { dfs(y, x); child.push_back(y); ... |
#include <bits/stdc++.h> struct Side { int x, y; Side(int x, int y) : x(x), y(y) {} }; struct Part { int id, z; Part() {} Part(int id, int z) : id(id), z(z) {} }; struct Answer { int a, b; Answer(){}; Answer(int a, int b) : a(a), b(b) {} }; bool operator<(const Side &left, ... |
//a.9 #include<bits/stdc++.h> #define ll long long #define all(x) x.begin(),x.end() #define CASE(t) cout<< Case # <<(t)<< : ; #define endll endl #define endl n #define INF 1e18 #define deb(x) cout << [ << (#x) << = << x << ] << n #define deb2(x,y) cout << [ << (#x) << = << x << ] [ ... |
/**
* 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 = 1234567; int a[N], gcd[N], is_max[N], cnt[N]; int main() { ios_base::sync_with_stdio(false); int n; cin >> n; for (int i = 0; i < n; ++i) { cin >> a[i]; a[i + n] = a[i]; } for (int i = 1; i <= n; ++i) { if (n %... |
/**
* 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 2018 (c) Analog Devices, Inc. All rights reserved.
//
// In this HDL repository, there are many different and unique modules, consisting
// of variou... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2010 by Wilson Snyder.
`ifndef VERILATOR
module t;
/*AUTOREGINPUT*/
// Beginning of automatic reg inputs (for undeclared instantiated-module inputs)
reg c0; // To t2 of t... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/**
* 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; char s[500010]; int num[500010]; int cnt; long long t, mid; int n; int skip[500010]; long long minn(long long a, long long b) { return a < b ? a : b; } stack<int> sta; int ok(long long k) { int i, j, end = -1, last, type = -1, cnt = 0; long long ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; int k; int values[107]; int n = 0; int ans[107][107]; int cmb[107]; int main() { int i, j, base; cin >> k; for (i = 3; i <= 100; i++) values[i] = i * (i - 1) * (i - 2) / 6; for (i = 2; i <= 100; i++) cmb[i] = i * (i - 1) / 2; i = 3; whi... |
/**
* 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> int32_t get_economy(std::vector<int32_t> joined_roots, int32_t** tree) { if (joined_roots.size() == 1) return 0; int32_t res = joined_roots.size() - 1; std::vector<int32_t> join_lists[26]; for (int32_t i = 0; i < joined_roots.size(); i++) for (int32_t j = 0; j < 26; j++)... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1e15; struct Edge { int t, w; } e[100010 << 1]; queue<int> g[100010]; long long d[100010], f[100010]; int i, j, k, n, m, q, x, h[100010]; struct _ { int x; _(int x) : x(x) {} bool operator<(const _& a) const { return d[x... |
#include <bits/stdc++.h> using namespace std; const int M = 5555; const int N = 205; int col[2][M][N]; void dfs(int p, int x, int y, int c0, int c1) { int t = col[p ^ 1][y][c0]; col[p][x][c0] = y; col[p ^ 1][y][c0] = x; if (!t) { col[p ^ 1][y][c1] = 0; return; } dfs(p ^ 1, ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 18:24:17 02/22/2015
// Design Name:
// Module Name: alu_y_pipelined
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
//... |
//-----------------------------------------------------------------------------
//
// (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
... |
/* -------------------------------------------------------------------------------
* (C)2007 Robert Mullins
* Computer Architecture Group, Computer Laboratory
* University of Cambridge, UK.
* -------------------------------------------------------------------------------
*
* Tree Matrix Arbiter
*
* - 'multist... |
#include <bits/stdc++.h> using namespace std; const int N = 40; const int F = N / 2 + N % 2; const int S = N - F; const long long N_MASKS = (1ll << N); const long long F_MASKS = (1ll << F); const long long S_MASKS = (1ll << S); double liquid; int n, f, s; long long adj[N]; int firstSizes[F_MASKS];... |
// Copyright (c) 2000-2012 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> #pragma GCC optimize( Ofast ) using namespace std; const long long int mod = 1e9 + 7; const long long int mod1 = 998244353; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); long long int rand(long long int l, long long int r) { uniform_int_distribution<long l... |
module test;
parameter TRUE = 1;
genvar i;
genvar j;
for (i = 0; i < 2; i = i + 1) begin : l1
reg r1 = 1;
end
for (i = 0; i < 2; i = i + 1) begin : l2
for (j = 0; j < 2; j = j + 1) begin : l1
reg r2 = 1;
end
end
for (i = 0; i < 2; i = i + 1) begin : l3
case (TRUE)
0: begin : c1
reg r3a = 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 n, a[1001][10], cnt, ans[1001]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d%d%d%d%d , &a[i][0], &a[i][1], &a[i][2], &a[i][3], &a[i][4]); } if (n > 11) { printf( 0 ); return 0; } for (int i = 1; i... |
//////////////////////////////////////////////////////////////////////
//// ////
//// can_register_syn.v ////
//// ////
//// ... |
/**
* 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... |
// $Id: router_wrap.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:
Redistributions ... |
#include <bits/stdc++.h> using namespace std; long long n, q; long long f(long long md) { return n - md + min(n - md, md * (md - 1) / 2); } signed main() { cin >> q; while (q--) { cin >> n; long long lo = 1, hi = n; while (lo + 1 < hi) { long long md = (lo + hi) >> 1; i... |
#include <bits/stdc++.h> using namespace std; string s[105]; int main() { int n, k; cin >> n >> k; for (int i = 1; i <= n; i++) { s[i] = Aa ; s[i][0] += i / 26; s[i][1] += i % 26; } for (int i = 1; i <= n - k + 1; i++) { string x; cin >> x; if (x == NO ) s... |
module vga_text(
clk25mhz,
hindex,
vindex,
standard,
emphasized,
background,
char_data,
font_data,
char_address,
font_address,
color
);
// Inputs
input wire clk25mhz;
input wire[9:0] hindex;
input wire[9:0] vindex;
input wire[13:0] font_data;
input wire[7:0] char_data;
input wire[3:0] standard;
input wire[... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, c, a; cin >> n >> c; vector<int> arr; for (int i = 0; i < n; i++) { cin >> a; arr.push_back(a); } int maxx = 0; for (int i = 0; i < n - 1; i++)... |
`include "hglobal.v"
`default_nettype none
`define NS_DBG_NXT_ADDR(adr) ((adr >= MAX_ADDR)?(MIN_ADDR):(adr + 1))
module io_2to1
#(parameter
MIN_ADDR=1,
MAX_ADDR=1,
ASZ=`NS_ADDRESS_SIZE,
DSZ=`NS_DATA_SIZE,
RSZ=`NS_REDUN_SIZE
)(
input wire src0_clk,
input wire src1_clk,
input wire snk0_clk,
input wire... |
//
// Copyright 2011-2012 Ettus Research 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 3 of the License, or
// (at your option) any later version.
//
// This program i... |
#include <bits/stdc++.h> using namespace std; const long long INF = (long long)1000 * 1000 * 1000 * 1000 * 1000 * 100; const int MOD = 1000 * 1000 * 1000 + 9; const int SIZE = 5000; int main() { std::ios_base::sync_with_stdio(false); int n; cin >> n; vector<int> a(n); vector<vector<int> > ... |
/**********************************************************************
* $my_monitor example -- Verilog HDL test bench.
*
* Verilog test bench to test the $my_monitor PLI application.
*
* For the book, "The Verilog PLI Handbook" by Stuart Sutherland
* Copyright 1999 & 2001, Kluwer Academic Publishers, Norwell, ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > days; vector<int> visited; int main() { int k, n; pair<int, int> temp; cin >> n >> k; for (int i = 0; i < n; i++) { temp.first = i + 1; cin >> temp.second; days.push_back(temp); } for (int i = 0; i < ... |
module linked_list_fifo_gold(rst, clk, push, push_fifo, pop, pop_fifo, d, q, empty, full, count);
parameter WIDTH = 8;
parameter DEPTH = 32;
parameter FIFOS = 8;
parameter FIFO_LOG2 = log2(FIFOS-1);
parameter DEPTH_LOG2 = log2(DEPTH-1);
input rst, clk, push;
input [FIFO_LOG2-1:0] push_fifo;
... |
// This file has been automatically generated by goFB and should not be edited by hand
// Compiler written by Hammond Pearce and available at github.com/kiwih/goFB
// Verilog support is EXPERIMENTAL ONLY
// This file represents the Basic Function Block for BfbOnePedCtrl
//defines for state names used internally
`defi... |
// megafunction wizard: %LPM_ADD_SUB%CBX%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: lpm_add_sub
// ============================================================
// File Name: add32.v
// Megafunction Name(s):
// lpm_add_sub
// ============================================================
// ***************... |
// 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 : Tue Sep 19 11:17:53 2017
// Host : vldmr-PC running 64-bit Service Pack 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... |
module t(
input clk_sys,
input _0_t,
input taa,
input tab,
input trb,
input clockta,
input clocktb,
input clocktc,
input t_1_d,
input [0:39] k,
input m_1,
output reg [-1:39] t
);
always @ (posedge clk_sys, posedge _0_t) begin
if (_0_t) t[0:15] <= 0;
else if (clockta) case ({~tab, ~taa})
2'b00: t[0:... |
// megafunction wizard: %ROM: 1-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: redDiskModule.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ======================... |
#include <bits/stdc++.h> using namespace std; using namespace chrono; struct stopwatch { time_point<high_resolution_clock> last_tick; bool notock = false; void tick() { last_tick = high_resolution_clock::now(); } void tock() const { duration<double> dur = high_resolution_clock::now() - last_... |
/**
* 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 bas... |
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << : << arg1 << n ; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, , ); ... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline T gi() { T f = 1, x = 0; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) f = -1; c = getchar(); } while (c >= 0 && c <= 9 ) x = x * 10 + c - 0 , c = getchar(); return f * x; } cons... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; scanf( %d%d , &n, &m); vector<int> mp(32); vector<int> A(m); for (int i = 0; i < n; i++) { int no; scanf( %d , &no); for (int ii = 0; ii < 31; ii++) if (no & (1 << ii)) mp[ii]++; } for (int 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... |
#include <bits/stdc++.h> using namespace std; const int maxx = 1e2 + 10; int a[maxx], b[maxx]; int n; inline bool check(int m) { int max1 = 0, max2 = 0; for (int i = 1; i <= n; i++) { if (a[i] && !b[i]) max1 += m; else if (a[i] && b[i]) max1 += 1, max2 += 1; else if (... |
#include <bits/stdc++.h> using namespace std; vector<int> g[1000010]; int n, k; bool r[1000010]; int s[1000010]; int m[1000010]; int main() { scanf( %d %d , &n, &k); for (int i = 0; i < k; i++) { int x, y; scanf( %d %d , &x, &y); g[x].push_back(y); } int v = 0; for (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 : Sun Jun 04 14:49:03 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; const int N = 24; int n, m, a[N][N], f[1 << 20]; char str[N][N]; void work() { int i, j, k, x; scanf( %d%d , &n, &m); for (i = 0; i < n; ++i) scanf( %s , str[i]); for (i = 0; i < n; ++i) for (j = 0; j < m; ++j) scanf( %d , &a[i][j]); for ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:35:00 11/07/2015
// Design Name:
// Module Name: Top_BackBox
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
/... |
module sha256_const(addr, k);
input wire [5:0] addr;
output wire [31:0] k;
wire [63:0] addr_decode;
my_decoder decoder(addr, addr_decode);
assign k = addr_decode[0] ? 32'h428a2f98 : 32'bz;
assign k = addr_decode[1] ? 32'h71374491 : 32'bz;
assign k = addr_decode[2] ? 32'hb5c0fbcf : 32'bz;
assign k = a... |
/* Problem # 13 */
`define max(a,b)((a) > (b) ? (a) : (b))
/* For things to make sense, divisor_width should be larger than
* duty_cycle_width */
module freq_div
#(parameter divisor_width = 8,
parameter duty_cycle_width = divisor_width)
(output reg out_clk,
input [divisor_width-1:0] divisor,
input [duty_cycle_w... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; int fst[N], v[2 * N], w[2 * N], nxt[2 * N], cnt = 1; bool vis[2 * N]; int c[N], ans[N], n; queue<int> q; void add(int x, int y, int z) { v[++cnt] = y, w[cnt] = z; c[y] += z; nxt[cnt] = fst[x], fst[x] = cnt; } void bfs() ... |
/**
* 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; inline int read_int() { int x; scanf( %i , &x); return x; } inline int endline() { return printf( n ); } inline int space() { return printf( ); } inline int write_int(const int x) { return printf( %i , x); } class color_ice_cream : public pair<b... |
module SPW_LIGHT_T(
input FPGA_CLK1_50,
input [1:0] KEY,
input din_a,
input sin_a,
//input din_b,
//input sin_b,
output dout_a,
output sout_a,
//output dout_b,
//output sout_b,
//////////// LED ////////////
... |
#include <bits/stdc++.h> using namespace std; int main() { int n, a = 0, k = 2000000000; cin >> n; for (int i = 0; i < n; i++) { int x; cin >> x; if (x % n <= i) x = x / n; else x = x / n + 1; if (x < k) { a = i; k = x; } } cout... |
////////////////////////////////////////////////////////////////////////////////
// Original Author: Schuyler Eldridge
// Contact Point: Schuyler Eldridge ()
// div_pipelined.v
// Created: 4.3.2012
// Modified: 4.5.2012
//
// Testbench for div_pipelined.v
//
// Copyright (C) 2012 Schuyler Eldridge, Boston Univ... |
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-8; const int INFI = 1000 * 1000 * 1000; const long long INFL = 1000LL * 1000LL * 1000LL * 1000LL * 1000LL; const int MX_N = 1000; int N; string s, t; string strs[] = { abc , acb , bac , bca , cab , cba }; int nstrs = 6; int mai... |
// ==============================================================
// 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... |
module TERASIC_IRM(
clk, // must be 50 MHZ
reset_n,
// interrrupt
irq,
// avalon slave
s_cs_n,
s_read,
s_readdata,
s_write,
s_writedata,
// export
ir
);
input clk;
input reset_n;
output reg irq;
input s_cs_n;
input s_read;
output [31:0] s_readdata;
input s_write;
input [31:0] s_writeda... |
/**
* 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... |
/*
Emesh interface wrapper for asynchronous fifo
*/
module fifo_async_emesh (/*AUTOARG*/
// Outputs
emesh_access_out, emesh_write_out, emesh_datamode_out,
emesh_ctrlmode_out, emesh_dstaddr_out, emesh_data_out,
emesh_srcaddr_out, fifo_full, fifo_progfull,
// Inputs
rd_clk, wr_clk, reset, emesh_ac... |
// Test the various string.Xtoa() methods
module testbench;
string str;
int val;
real valr;
task test_string_value(string str, string reference);
if (str != reference) begin
$display("FAILED -- str=%0s, should be %s", str, reference);
$finish;
end
endtask // test_string_value
... |
/**
* 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 <class T> inline int read(T& x) { static char ch; static bool neg; for (ch = neg = 0; ch < 0 || 9 < ch; neg |= ch == - , ch = getchar()) ; for (x = 0; 0 <= ch && ch <= 9 ; (x *= 10) += ch - 0 , ch = getchar()) ; return... |
#include <bits/stdc++.h> int n, m, k, s, a[1000000], b[1000000]; int amin[1000000]; int bmin[1000000]; struct Gadget { long long cost; int id; Gadget(long long cost, int id) : cost(cost), id(id) {} bool operator<(const Gadget &other) const { return cost < other.cost; } }; int main() { sc... |
#include<bits/stdc++.h> #define int long long #define ld long double #define fi first #define se second #define vll vector<int> #define pii pair<int,int> #define pb push_back #define sz(v) (int)(v).size() #define inf (int)(1e18) #define md (int)(998244353) #define all(v) (v).begin(),(v).end() #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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.