text stringlengths 59 71.4k |
|---|
/* This file is part of JT12.
JT12 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.
JT12 is distributed in the hope tha... |
`include "../../sources_1/new/defines.v"
//////////////////////////////////////////////////////////////////////////////////
// Company: WSIZ Copernicus
// Engineer: Rafa³ B., Szymon S., Darek B.
//
// Create Date: 26.04.2017 18:27:52
// Design Name:
// Module Name: test_bench
// Project Name:
// Target Devices:
//... |
/**
* 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> #include<unordered_map> using namespace std; typedef long long ll; typedef vector<ll> vll; const ll M = 1000000007; bool compare(vll x, vll y) { if (x[0] < y[0]) { return true; } return false; } void solve() { vector<vll> v(3); ll n1, n2... |
/*
* 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 q[111], qr[111], s[111]; int d[222][111]; int dp[111][222]; bool ss[222]; int n, k; bool rec(int kk, int i) { if (dp[kk][k + i] != -1) return dp[kk][k + i]; if (kk == 0) return ss[k + i]; bool r; if (ss[k + i]) r = false; else { ... |
#include <bits/stdc++.h> using namespace std; int n, neg = 0; char s[1009]; int main() { vector<int> ans; scanf( %[^=]=%d , s, &n); ans.push_back(n); for (int i = 1; s[i]; i++) { if (s[i] == ) continue; if (s[i] == - ) neg = 1; else if (s[i] == + ) neg = 0;... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); double l, p, q; cin >> l >> p >> q; cout << setprecision(9) << (p * l) / (p + q); return 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 law... |
#include <bits/stdc++.h> using namespace std; int n, m, k; vector<int> v[1000010]; vector<int> vv; bool visit[1000010] = {0}; int t, tt; int res = 0; void dfs(int x) { visit[x] = 1; t++; for (int i = 0; i < v[x].size(); i++) { int xi = v[x][i]; if (!visit[xi]) dfs(xi); } } ... |
// Three basic tests in here:
// 1. byte must be initialised before any initial or always block
// 2. assignments to (unsigned) bytes with random numbers
// 3. assignments to (unsigned) bytes with random values including X and Z
module ibyte_test;
parameter TRIALS = 100;
parameter MAX = 'h7fffffff;
reg [31:0] a... |
// ====================================================================
// Radio-86RK FPGA REPLICA
//
// Copyright (C) 2011 Dmitry Tselikov
//
// This core is distributed under modified BSD license.
// For complete licensing information see LICENSE.TXT.
// -----------------------------... |
#include <bits/stdc++.h> using namespace std; template <class T> inline void chkmax(T &a, T b) { if (a < b) a = b; } template <class T> inline void chkmin(T &a, T b) { if (a > b) a = b; } inline int read() { int sum = 0, p = 1; char ch = getchar(); while (!(( 0 <= ch && ch <= 9 ) |... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; template <typename T> void uin(T &a, T b) { if (b < a) a = b; } template <typename T> void uax(T &a, T b) { if (b > a) a = b; } const long long maxn = 1000 * 1000 + 228; long long n, k; long long dp[maxn], p[maxn];... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int i, j; int k, n, s, p; cin >> k >> n >> s >> p; cout << int(ceil((ceil(n / (s * 1.0)) * k) / (p * 1.0))); return 0; } |
#include <bits/stdc++.h> using namespace std; using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>; using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>; bool sorted(int arr[], int n) { bool f1 = 1, f2 = 1; for (int i = 0; i < n - 1; i++) { if (arr... |
/*
* Milkymist VJ SoC
* Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq
*
* 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, version 3 of the License.
*
* This program is distributed ... |
#include <bits/stdc++.h> using namespace std; int main() { long long int b, l, d; cin >> b >> l >> d; long long int m = b; if (l > m) { m = l; } if (d > m) { m = d; } long long int miss = 0; if (m - 1 - b > 0) { miss += m - 1 - b; } if (m - 1 - l > 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... |
// Test implicit casts during procedural blocking assignments.
module implicit_cast();
real src_r;
bit unsigned [7:0] src_u2;
bit signed [7:0] src_s2;
logic unsigned [7:0] src_u4;
logic signed [7:0] src_s4;
logic unsigned [7:0] src_ux;
logic signed [7:0] src_sx;
real ... |
/**
* 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 M = 1e5 + 5; vector<pair<long long, long long>> v; int main() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); long long x, y, bx, by, xs, ys, t, temp1, temp2, temp; long long ax, ay; int ans = 0; cin >> x >> y >> ax >... |
#include <bits/stdc++.h> using namespace std; const int Max = 1e6 + 100; int pa[Max << 1], son[Max << 1][27]; int deep[Max << 1], sum[Max << 1], tp[Max << 1], S[Max << 1], cnt, root, last; char str[Max << 1]; inline int Newnode(int _deep) { deep[++cnt] = _deep; return cnt; } inline void SAM(int ... |
/*
* 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 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017
// Date : Tue Apr 18 23:18:54 2017
// Host : DESKTOP-I9J3TQJ running 64-bit major re... |
`timescale 1ns / 1ps
//Source: http://www.bigmessowires.com/2009/06/21/fpga-pong/
//
// -----------------------------------------------
// updates the ball and paddle positions, and
// determines the output video image
// -----------------------------------------------
module game_module2015(input clk25, input Reset... |
#include <bits/stdc++.h> using namespace std; int q, n; bool ok(long long edg) { long long b = (edg + 1) >> 1, o = (n - b) * (n - b - 1) >> 1; return (b + min(edg >> 1, o)) == edg && b < n; } long long bs() { long long beg = 0, end = 2LL * n, mid; while (beg < end) { mid = (beg + end + 1... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 13:10:19 04/20/2015
// Design Name:
// Module Name: seven_seg_wrapper
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
... |
module fifo # (parameter abits = 7, dbits = 1)(
input reset, clock,
input rd, wr,
input [dbits-1:0] din,
output [dbits-1:0] dout,
output empty,
output full,
output reg ledres
);
wire db_wr, db_rd;
reg dffw1, dffw2, dffr1, dffr2;
reg [dbits-1:0] out;
//initial ledres = 0;
always @ ... |
/*
Copyright 2015, Google Inc.
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Engineer: Jonathan Whitaker
//
// Create Date: 17:51:49 04/07/2014
// Module Name: fourbit_cpu
// Description: This verilog module implements a 4-bit cpu with manual instruction
// entr... |
#include <bits/stdc++.h> using namespace std; const int N = 200000 + 10; const long long INF = 0x3f3f3f3f3f3f3f3fLL; long long dp[105][105][105]; long long c[105], val[105][105], ans = INF; int main() { int i, j, K, n, m, k; cin >> n >> m >> K; for (i = 1; i <= n; i++) cin >> c[i]; for (i = ... |
#include <bits/stdc++.h> using namespace std; int t[123]; int main() { ios::sync_with_stdio(0); cin.tie(0); int a, n; cin >> n >> a; --a; for (int i = 0; i < n; ++i) cin >> t[i]; int l, r; l = r = a; int res = 0; while (l >= 0 || r < n) { if (l >= 0 && r < n) { ... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; const long long inf = 1e9; const long long ninf = LLONG_MIN; const double eps = 1e-12; const long long N = 1000005; const long long LOGN = 19; const double PI = 3.14159265358979323846; long long n, m; long long d[505][50... |
//-----------------------------------------------------------------------------------------
//-- txstr: Uart_tx example 2
//-- Transmission of string
//-- The reset signal is connected to the dtr signal (in file txstr.pcf)
//-- Fot this example to work is necessary to open a serial terminal
//-- (gtkterm for example)
/... |
/**
* 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... |
/*
* Wishbone Compatible BIOS ROM core using megafunction ROM
* Copyright (C) 2010 Donna Polehn <>
*
* This file is part of the Zet processor. This processor is free
* hardware; you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by the Free Software
* ... |
#include <bits/stdc++.h> using namespace std; const int MM = 120000; vector<int> G[MM], T[MM]; int P[MM], L[MM]; void dfs(int u, int par) { P[u] = par; if (par != -1) L[u] = L[par] + 1; for (auto v : G[u]) { if (v != par) { dfs(v, u); } } } int N, K; bool rip = 0; v... |
`timescale 1 ps / 1 ps
module Sobel_cache (
input clk,
input rst,
input start,
input [ADD_WIDTH-1:0] base_add,
input [13:0] rdaddress,
output wire [12:0] valid_lines,
input free_line,
output wire [ 7:0] q,
output wire [ADD_WIDTH-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... |
#include <bits/stdc++.h> using namespace std; namespace thecold { inline int read() { int res = 0; bool flag = false; char c = getchar(); while (!isdigit(c)) flag = (c == - ), c = getchar(); while (isdigit(c)) res = res * 10 + (c ^ 48), c = getchar(); return !flag ? res : -res; } cons... |
#include <bits/stdc++.h> using namespace std; int n, m, k, trap[510]; int e[510][510]; long double t[510][510]; const long double EPS = 1e-9; void mult(long double a[110][110], long double b[110][110], long double c[110][110]) { long double r[110][110] = {}; for (int i = 0; i < (int)(110... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: sctag_tagctlrep.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 a... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); string s; cin >> s; long long a = -1, b = -1; int flag = 0; for (int i = 0; i < s.length(); i++) { if (s[i] == [ ) { a = i; flag = 1; break; } ... |
#include <bits/stdc++.h> using namespace std; int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}; int dy8[] = {0, 1, 1, 1, 0, -1, -1, -1}; int dx4[] = {1, 0, -1, 0}; int dy4[] = {0, 1, 0, -1}; template <typename Arg1> void __f(const char *name, Arg1 &&arg1) { cerr << name << : << arg1 << n ; ; } te... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:58:11 07/01/2012
// Design Name:
// Module Name: GPIO
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Re... |
#include <bits/stdc++.h> using namespace std; int main() { long long k, n, s, p; cin >> k >> n >> s >> p; long long w = n / s; if (n % s != 0) w++; w *= k; long long ans = w / p; if (w % p != 0) ans++; cout << ans << 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... |
#include <bits/stdc++.h> using namespace std; int main(void) { string s, t; cin >> s >> t; int ind = -1; for (int i = 0; i < s.length(); i++) { if (s[i] != 0 ) break; else ind = i; } s = s.substr(ind + 1); ind = -1; for (int i = 0; i < t.length(); i++) { ... |
#include <bits/stdc++.h> using namespace std; char str[100010]; int main() { int ans[] = {4, 0, 0, 0}; while (~scanf( %s , str)) { int tmp = 0; int len = strlen(str); for (int i = 0; i < len; ++i) { tmp = tmp * 10 + str[i] - 0 ; tmp %= 4; } printf( %d n , ans... |
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017
// Date : Tue Sep 19 00:29:41 2017
// Host : DarkCube running 64-bit major release ... |
#include <bits/stdc++.h> using namespace std; int main() { long long int i, j, ans = 1, val[256], v; string s, p; cin >> s; char a; for (a = 0 ; a <= 9 ; a++) { p.push_back(a); } for (a = A ; a <= Z ; a++) { p.push_back(a); } for (a = a ; a <= z ; a++) { p... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k, l, r, sall, sk; cin >> n >> k >> l >> r >> sall >> sk; int el[n]; int div, mod, m, sm; m = n - k; sm = sall - sk; if (k > 0) { div = sk / k; mod = sk % k; for (int i = 0; i < k; i++) { el[i] = ... |
#include <bits/stdc++.h> using namespace std; struct P { double x, y; } a[259]; long long f[259][259]; int n; int read() { long long x = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == - ) f = -1; ch = getchar(); } while (isdigit(ch)) { x = x * 10 +... |
/*
Copyright (c) 2016-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 dx[] = {0, 0, 1, -1, 1, -1, 1, -1}; int dy[] = {1, -1, 0, 0, -1, 1, 1, -1}; long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); } long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; } long long power(long long a, long l... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2013, David M. Lloyd
//
// This file is part of the PBIBox suite.
//
// PBIBox is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as publ... |
/**
* 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, m, b, mod; int a[505]; int dp[505][505]; int main() { scanf( %d%d%d%d , &n, &m, &b, &mod); for (int i = 1; i <= n; ++i) scanf( %d , a + i); dp[0][0] = 1; for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++j) { for (int k ... |
// 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... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.2
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1n... |
#include <bits/stdc++.h> using namespace std; const int N = 5000 + 10; int n, a[N], dp[N][N][2]; int calc(int i, int rem, bool isLess) { if (rem == 0) return 0; if (i >= n) return 2e9; int &ret = dp[i][rem][isLess]; if (ret != -1) return ret; ret = 2e9; if (isLess) { if (i != 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 law... |
#include <bits/stdc++.h> int main() { int x, y, z, i, j, k, a, b, c, n, m, t, mat[210210]; scanf( %d , &t); long long w, sum; while (t--) { scanf( %d %lld , &n, &w); j = -1; sum = 0; c = 0; for (x = 0; x < n; x++) { scanf( %d , &mat[x]); if (mat[x] >= (w +... |
//`define HIGH_BIOS 13'h0000
`define HIGH_BIOS 13'h00FF
module flash_dump (
input sys_clk_in,
output trx,
output [20:0] flash_addr,
input [15:0] flash_data,
output flash_we_n,
output flash_oe_n,
output flash_ce2
);
reg clk_9600;
... |
#include <bits/stdc++.h> int main() { int n, m; int a, b; int min1, min2; int s1 = 0, s2 = 0, k1 = 0, k2 = 0; scanf( %d%d , &n, &m); while (n--) { scanf( %d , &a); if (a % 2 == 0) s1++; else s2++; } while (m--) { scanf( %d , &b); if (b % 2 ... |
#include <bits/stdc++.h> using namespace std; int main() { int k; int l; cin >> k >> l; int u[k]; int y[l]; for (int i = 0; i < k; i++) { cin >> u[i]; } for (int i = 0; i < l; i++) { cin >> y[i]; } long long int h = 0; long long int v = 0; int f = 0; i... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:28:30 03/06/2016
// Design Name: summed
// Module Name: C:/XilinxP/Practica1/summed_test.v
// Project Name: Practica1
// Target Device:
// Tool versi... |
#include <bits/stdc++.h> using namespace std; long long a[200100]; int main() { long long k, Answer = 0; int n; cin >> n >> k; for (int i = 0; i < n; i++) scanf( %I64d , &a[i]); for (int i = 0; i < n; i++) { Answer += a[i] / k; a[i] = a[i] % k; if (a[i] + a[i + 1] >= k) ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e6 + 500; const long double eps = (1e-12); const int logn = 21; const double Pi = acos(-1.0); const long long pp = 998244353; int lowbit(int x) { return x & (-x); } const long long INF = 1e11 + 7; long long dp[3][205][4]; long long a[MA... |
#include <bits/stdc++.h> using namespace std; bool comp(const vector<int> &l, const vector<int> &r) { if (l[0] % 2 && r[0] % 2) { return l[1] < r[1]; } if ((l[0] % 2) && (r[0] % 2 == 0)) return true; if ((l[0] % 2 == 0) && (r[0] % 2)) return false; else return true; } int m... |
#include <bits/stdc++.h> using namespace std; const long long maxn = 1e5 + 5; long long n, a[maxn], dp[maxn][2], f[maxn][2], d[maxn]; long long head[maxn], ecnt; struct edge { long long to, next; } e[maxn << 1]; void adde(long long u, long long v) { e[++ecnt].to = v; e[ecnt].next = head[u]; ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; const long long mod = 1e9 + 7; long long qpow(long long a, long long b) { long long res = 1; while (b) { if (b & 1) res = res * a % mod; a = a * a % mod; b >>= 1; } return res; } int n; int vis[N], prim... |
#include <bits/stdc++.h> using namespace std; long long nt[105]; string s; vector<long long> V; void ts() { nt[0] = 0; nt[1] = 0; for (long long i = 2; i <= 100; i++) { nt[i] = 1; } for (long long i = 2; i <= 100; i++) { if (nt[i] == 1) { for (long long j = i * i; j <= ... |
// (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 simulati... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } template <class T1, class T2> struct cmpf { bool rev; inline bool operator()(const pair<T1, T2>& a, const pair<T1, T2>& b) const { return (a.first < b.first) ^ rev; } cmp... |
//======================================================================
//
// tb_blake2_G.v
// -------------
// Testbench for the Blake2 G function.
//
//
// Author: Joachim Strömbergson
// Copyright (c) 2014, Secworks Sweden AB
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or
/... |
#include <bits/stdc++.h> using namespace std; int n, m, a[5005], b[5005], c[5005], dp[5005][5005][2], size[5005]; vector<int> G[5005]; void DP(int u) { size[u] = 1; dp[u][0][0] = 0; dp[u][1][0] = a[u]; dp[u][1][1] = a[u] - b[u]; for (int i = 0; i < G[u].size(); i++) { int v = G[u][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... |
/*
* Text mode graphics for VGA
* Copyright (C) 2010 Zeus Gomez Marmolejo <>
*
* VGA FML support
* Copyright (C) 2013 Charley Picker <>
*
* This file is part of the Zet processor. This processor is free
* hardware; you can redistribute it and/or modify it under the terms of
* the GNU General P... |
`include "define.v"
module memory( clk, rst, cs, wen, addr, data_in, fileid, data_out);
parameter ASIZE=16;
parameter DSIZE=16;
parameter STATE=2;//2**STATE >= LATENCY
parameter LATENCY=3;
input clk;
input rst;
input cs;
input wen;
input [ASIZE-1:0] addr; // address input
input [DSIZE-1:0] data_in; ... |
#include <bits/stdc++.h> using namespace std; inline int read() { int f = 1, x = 0; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) { f = -1; } ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = x * 10 + ch - 0 ; ch = getchar(); }... |
#include <bits/stdc++.h> using namespace std; const int MxN = (int)15e4 + 9; int n, Q; int parent[MxN + 9]; vector<int> adj[MxN + 9]; int height[MxN + 9]; char label[MxN + 9]; const string YES = Shi ; const string NO = Fou ; int parent2[MxN + 9]; vector<int> adj2[MxN + 9]; array<int, 26> label... |
/**
* 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 apsz = 26; const long long o = 1; const int maxn = 300007; const int ooi = 1e9 + 7; const int up = 62; int n; long long mask[maxn]; long long val[maxn]; inline int hb(long long x) { int k = 0; while ((o << (k + 1)) <= x) k++; return... |
`include "../config.inc"
`include "../video2ram.v"
`include "../edge_detect.v"
`include "../Flag_CrossDomain.v"
`include "../ram2video.v"
module video2ram_tb;
reg clkIn = 0;
reg clkOut = 0;
reg [11:0] counterX;
reg [11:0] counterY;
wire [23:0] wrdata;
wire [23:0] rddata;
wire [14:0] wraddr;
wire wre... |
//----------------------------------------------------------------------------
//-- Ejemplo 1 de puerta tri-estado
//-- Conectar y desconectar un biestable a 1 al led, a través de
//-- una puerta tri-estado, con una cadencia de 1 segundo
//----------------------------------------------------------------------------
//... |
#include <bits/stdc++.h> using namespace std; const int max_n = 303333, inf = 1000111222; int n, x, y; pair<int, int> a[max_n]; void wa() { printf( No n ); exit(0); } int main() { scanf( %d%d%d , &n, &x, &y); for (int i = 0; i < n; ++i) { scanf( %d , &a[i].first); a[i].second =... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2016.1
// Copyright (C) 1986-2016 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1ns/1ps
... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1e13, Mo = 998244353; const int N = 1000000; const double eps = 1e-6; namespace slow_IO { long long read() { long long x = 0; int zf = 1; char ch = getchar(); while (ch != - && (ch < 0 || ch > 9 )) ch = getchar(); i... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10:18:18 10/17/2016
// Design Name:
// Module Name: num_6
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependenc... |
/*
* Milkymist VJ SoC
* Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
*
* 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, version 3 of the License.
*
* This program is distri... |
#include <bits/stdc++.h> using namespace std; pair<long long, long long> a[200005]; signed main() { long long n, j; cin >> n >> j; j %= 2 * n; long long x0, y0; cin >> x0 >> y0; for (long long i = 0; i < n; i++) { cin >> a[i].first >> a[i].second; } for (long long i = 1; i <=... |
/*
Anthony De Caria - April 4, 2014
This module creates a Shift Register with a seperate enable signal.
This specific module creates an output that is 16-bits wide.
This module uses asyncronous D Flip Flops.
It also can allow data to be inputed into the flip flops before shifting.
*/
module ShiftRegisterWEnableSixtee... |
// (c) Copyright 1995-2016 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; char s[200010], t[200010]; string ans; void solve() { int n = strlen(s), x = 0; for (int i = 0; i < n; i++) { if (i) ans += + ; if (i < n - 1 && rand() % 2 == 0) { ans += (s[i]), ans += s[++i]; x += 10 * (s[i - 1] - 0 ) + s[i] -... |
// ==============================================================
// 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 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 N = 1e6; vector<vector<int>> g(N); bool isDeleted[N]; vector<int> res; void del(int s, int p) { res.push_back(s); isDeleted[s] = true; for (auto I : g[s]) { if (!isDeleted[I] && I != p) { del(I, s); } } } bool df... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.