text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const int N = 75010; struct edge { int y, next; } s[N]; struct loop { vector<int> V; int S; } P[N]; struct node { int x, y, d; bool operator<(const node q) const { return x < q.x; } }; vector<node> A; vector<int> F[32768]; int first... |
`timescale 1ns/10ps
module pll_0002(
// interface 'refclk'
input wire refclk,
// interface 'reset'
input wire rst,
// interface 'outclk0'
output wire outclk_0,
// interface 'outclk1'
output wire outclk_1,
// interface 'locked'
output wire locked
);
altera_pll #(
.fractional_vco_multiplier("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 law... |
`ifdef __ICARUS__
`define SUPPORT_REAL_MODULUS_IN_IVTEST
`endif
module test();
function integer add2(input integer x);
begin
x += 2.0;
add2 = x;
end
endfunction
function integer sub2(input integer x);
begin
x -= 2.0;
sub2 = x;
end
endfunction
function integer mul2(input integer x);
begin
x *= 2.0;
mul... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: sparc_exu_aluspr.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 ... |
#include <bits/stdc++.h> using namespace std; int n, k; vector<int> p, q; vector<char> d; int main() { cin >> n >> k; p.resize(n); q.resize(n); d.resize(n); for (int i = 0; i < n; i++) { cin >> d[i] >> p[i] >> q[i]; } map<int, int> b, s; for (int i = 0; i < n; i++) { ... |
#include <bits/stdc++.h> using namespace std; inline long long add(long long a, long long b) { return ((a % 1000000007LL) + (b % 1000000007LL)) % 1000000007LL; } inline long long mul(long long a, long long b) { return ((a % 1000000007LL) * (b % 1000000007LL)) % 1000000007LL; } inline long long sub(l... |
#include <bits/stdc++.h> int max(int a, int b) { return a < b ? b : a; } int min(int a, int b) { return a < b ? a : b; } void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; } int can(int x, int y, int a, int b) { if ((x <= a && y <= b) || (x <= b && y <= a)) return 1; return 0; } ... |
// 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 (clk);
input clk;
reg [63:0] inwide;
reg [39:0] addr;
integer cyc; initial cyc=1;
... |
#include <bits/stdc++.h> using namespace std; long long int gcd(long long int a, long long int b) { if (b == 0) return a; return gcd(b, a % b); } long long int lcm(long long int a, long long int b) { return (a / gcd(a, b)) * b; } long long int dp[2005][2005]; long long int help(long long int n... |
#include <bits/stdc++.h> using namespace std; const long long maxn = 100; string v[maxn]; long long cn[26]; char mp[101][10000]; signed main() { long long n; cin >> n; string ts = aouie ; for (long long i = 5; i < n && n / i >= 5; i++) { if (n % i) continue; for (long long j = 0... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, k; cin >> n >> k; vector<pair<long double, long double>> v; for (long long int i = 0; i < n; i++) { long double x, y; cin >> x >> y; v.push_back(make_pair(x, y)); } long double sum = 0; for (lon... |
#include <bits/stdc++.h> using namespace std; int main() { int ans = 0, n; string s; cin >> n; for (int i = 1; i <= n; i++) { cin >> s; int flag = 0; for (int i = 0; i < s.length(); i++) if (s[i] == + ) flag = 1; if (flag) ans += 1; else ans -= ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long int n, x; cin >> n >> x; long long int a[n]; a[0] = 0; string s; cin >> s; for (int i = 0; i < n; i++) { char ch; ch = s[i]; if (i == 0) {... |
#include <bits/stdc++.h> using namespace std; int main() { int b = -1, n = 0, limit = 10; string pass, box = 0000000000 , zero, one, two, three, four, five, six, seven, eight, nine; cin >> pass; cin >> zero; cin >> one; cin >> two; cin >> three; cin >> four; cin... |
/*
* Copyright (c) 2015-2018 The Ultiparc Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 15:42:20 10/14/2015
// Design Name:
// Module Name: rotator
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
//... |
//#############################################################################
//# Function: Clock mux #
//#############################################################################
//# Author: Andreas Olofsson #
... |
#include <bits/stdc++.h> inline int read() { register int x = 0; register char f = 1, ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == - ) f = !f; for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 0 ); return f ? x : -x; } int n, d[250005], X, vis[250005... |
#include <bits/stdc++.h> using namespace std; long long n, h, a, b, k, s[10001]; int main() { scanf( %lld%lld%lld%lld%lld , &n, &h, &a, &b, &k); for (int i = 1; i <= k; i++) { long long u1, v1, u2, v2; scanf( %lld%lld%lld%lld , &u1, &v1, &u2, &v2); if (u1 == u2) s[i] = abs(v1 - v... |
#include <bits/stdc++.h> using namespace std; const int BUF = 200005; const long long INF = 1LL << 61; int n; long long toAdd; long long arrive[BUF]; int maxOrder[BUF]; void read() { cin >> n >> toAdd; for (int i = 0; i < n; ++i) { cin >> arrive[i]; } 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... |
//Legal Notice: (C)2019 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 do... |
#include <bits/stdc++.h> using namespace std; long long s[110000], a[110000]; int main() { int n; scanf( %d , &n); a[0] = 1; for (int i = 1; i <= 500; i++) a[i] = a[i - 1] * 2 % 1000000007; memset(s, 0, sizeof(s)); for (int i = 1; i <= n; i++) { int x; scanf( %d , &x); if... |
#include <bits/stdc++.h> using namespace std; int h; long long n; long long dfs(int d, long long n, int lr) { if (d == h) return 0; long long tmp = 1ll << (h - d - 1); if (!lr && n <= tmp) return dfs(d + 1, n, !lr) + 1; if (!lr && n > tmp) return (tmp << 1) + dfs(d + 1, n - tmp, 0); if (lr &... |
#include <bits/stdc++.h> using namespace std; const int Maxn = 200005; const int Maxl = 20; int table[Maxl][Maxn]; int tableor[Maxl][Maxn]; int numlog[Maxn]; int n, a[Maxn]; void buildTable() { numlog[1] = 0; for (int i = 2; i <= n; i++) { numlog[i] = numlog[i >> 1] + 1; } for (int... |
#include <bits/stdc++.h> using namespace std; mt19937_64 rang( chrono::high_resolution_clock::now().time_since_epoch().count()); int rng(int lim) { uniform_int_distribution<int> uid(0, lim - 1); return uid(rang); } const int INF = 0x3f3f3f3f; const int mod = 1e9 + 7; void solve() { int s... |
#include <bits/stdc++.h> using namespace std; long long mod = 1000000007, oo = 1000000009; void Emsawy() {} int dx[] = {1, -1, 0, 0, 1, -1, 1, -1}; int dy[] = {0, 0, 1, -1, 1, -1, -1, 1}; vector<vector<pair<int, int> > > adj; int n, m, k, w, h; struct Node { vector<int> ord; int cnt; Node() ... |
#include <bits/stdc++.h> using namespace std; bool ask(long long l, long long r) { cout << l << << r << n ; cout.flush(); string res; cin >> res; return res == Yes ; } int main() { srand(time(NULL)); ios_base::sync_with_stdio(false); long long n, k; cin >> n >> k; ... |
#include <bits/stdc++.h> using namespace std; const int N = 3050; int n, p, s; int sump[N], sum[N]; struct Student { int a, b, id; void input() { scanf( %d%d , &a, &b); } bool operator<(const Student &student) const { return b - a < student.b - student.a; } } data[N]; void del() { ... |
#include <bits/stdc++.h> using namespace std; inline void read(int &x) { int v = 0, f = 1; char c = getchar(); while (!isdigit(c) && c != - ) c = getchar(); if (c == - ) f = -1; else v = (c & 15); while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15); x = v * f;... |
#include <bits/stdc++.h> using namespace std; double jav, ans, a[10], b[10], h[5]; int main() { for (int i = 1; i <= 5; i++) cin >> a[i]; for (int i = 1; i <= 5; i++) cin >> b[i]; cin >> h[0] >> h[1]; for (int i = 1; i <= 5; i++) jav += max((double)(150 * i), (1 - (a[i] / 250)) * 500 * i - b... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 1e6 + 5; long long magic_const = 3e18; const int MAX_L = 3; class segment_tree { int n; vector<long long> val; vector<long long> pushes; int l, r; long long ans, adding_value; void push(int v, bool is_leaf) { val[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... |
// 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 May 28 20:04:14 2017
// Host : GILAMONSTER running 64-bit major release (... |
/**
* 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; struct hash { int head[8592637], next[8592637], t; unsigned long long lk[8592637]; double x[8592637]; double find(unsigned long long s) { for (int i = head[s % 8592637]; i; i = next[i]) if (lk[i] == s) return x[i]; return -1; } ... |
#include <bits/stdc++.h> using namespace std; int n; string str; int main() { cin >> str; n = str.length(); string str1 = str + str; reverse(str.begin(), str.end()); string str2 = str + str; int ans = 0; int dp[2][2 * n]; for (int i = 0; i < 2 * n - 1; i++) { dp[0][i] = 1; ... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7, SZ = 10000007; int nxt[200009]; char a[200][200]; int n, m, k, vid; vector<int> spf(SZ); vector<int> primes; void sieve() { for (int i = 1; i < SZ; i++) spf[i] = i; for (long long i = 2; i * i < SZ; i++) { if (spf... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; int pre[N], n, m; int f(int x) { return pre[x] == x ? x : pre[x] = f(pre[x]); } set<int> s[N]; map<int, vector<int> > v[N]; void join(int x, int y) { x = f(x); y = f(y); if (x == y) return; if (s[x].size() < s[y].size())... |
//------------------------------------------------------------------------------
//-- Procesador SIMPLEZ F: Implementacion del procesador SIMPLEZ de Gregorio //-- Fernandez en FPGA, mediante lenguaje Verilog
//------------------------------------------------------------------------------
//-- (C) 2015-2017, Juan Gonz... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2013(c) Analog Devices, Inc.
// Author: Lars-Peter Clausen <>
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 200007; string s; int fa[maxn << 1]; map<string, int> aa; int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); } string read() { cin >> s; return s; } int main() { int n, m, q; scanf( %d%d%d , &n, &m, &q); for... |
#include <bits/stdc++.h> using namespace std; template <class T> inline T min(T a, T b, T c) { return min(min(a, b), c); } template <class T> inline T min(T a, T b, T c, T d) { return min(min(a, b), min(c, d)); } template <class T> inline T max(T a, T b, T c) { return max(max(a, b), c); ... |
#include <bits/stdc++.h> using namespace std; int main() { int T; scanf( %d , &T); while (T--) { int a[255]; int s = 0; for (int i = 0; i < 250; i++) { scanf( %d , &a[i]); s += a[i]; } double ave = s / 250.0; int cnt = 0; for (int i = 0; i < 250;... |
module MPUC541 ( CLK,DS ,ED, MPYJ,DR,DI ,DOR ,DOI );
parameter total_bits = 32;
input CLK ;
wire CLK ;
input DS ;
wire DS ;
input ED; //data strobe
input MPYJ ; //the result is multiplied by -j
wire MPYJ ;
input [total_bits-1:0] DR ;
wire signed [total_bits-1:0] DR ;
input [total_bits-1:0] DI ;
... |
///////////////////////////////////////////////////////////////////////////////
// $Id: small_fifo.v 4761 2008-12-27 01:11:00Z jnaous $
//
// Module: small_fifo.v
// Project: UNET
// Description: small fifo with no fallthrough i.e. data valid after rd is high
//
// Change history:
// 7/20/07 -- Set nearly full to 2^M... |
// 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> using namespace std; int main() { long long x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, x6, y6; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4 >> x5 >> y5 >> x6 >> y6; long long a1 = (x2 - x1) * (y2 - y1); x3 = max(x3, x1); x4 = min(x4, x2); x5 = max(x5, x1); x6... |
// -*- Mode: Verilog -*-
// Filename : wb_ram_xilinx.v
// Description : WB RAM for Xilixn
// Author : Philip Tracton
// Created On : Tue Jan 3 15:01:51 2017
// Last Modified By: Philip Tracton
// Last Modified On: Tue Jan 3 15:01:51 2017
// Update Count : 0
// ... |
#include <bits/stdc++.h> using namespace std; long long n, a[2000005], num[2000005], ans; long long ksm(long long x, long long y) { long long ans = 1, t = x; while (y) { if (y & 1) ans = ans * t % 1000000007; t = t * t % 1000000007; y >>= 1; } return ans; } int main() { s... |
#include <bits/stdc++.h> int modul(long long x, long long y) { if (x < y) return y - x; else return x - y; } long long rez, n, i, ant, x; int main() { scanf( %I64d , &n); ant = 0; for (i = 1; i <= n; i++) { scanf( %I64d , &x); rez += modul(x, ant); ant = 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 law... |
#include <bits/stdc++.h> using namespace std; const long long inf = 1ll << 62; struct Query { long long n; int id; Query(long long _n = 0, int _id = 0) : n(_n), id(_id) {} inline bool operator<(const Query& rhs) const { return n > rhs.n; } } qry[100010]; long long ans[100010]; vector<pair<lo... |
#include <bits/stdc++.h> const double PI = acos(-1.0); const int INF = 0x3f3f3f3f; const double eps = 1e-8; const int MAXN = 1e3 + 10; const long long MOD = 1e9 + 7; int cases = 0; using std::string; const int dir[][2] = {{-1, 0}, {-1, -1}, {-1, 1}, {0, -1}, {0, 1}, {1, -1}, {1... |
// 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
`define checks(gotv,expv) do if ((gotv) != (expv)) begin $write("%%Error: %s:%0d: got='%s' exp='%s'\n", `... |
//Legal Notice: (C)2020 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 do... |
// 16-bit ALU
/*
0-7: {sd, scb, sb, sab}
8-15: {sd, sca, sb, saa}
.-> saryt
| .-> ~sd, ~sca, ~sb, ~saa (s[3:0])
| | .-> ~sd, ~scb, ~sb, ~sab (s[3:0])
| | |
A+B 1 1001 1001 ad, lws, rws, js, lj, ib, trb, krb
A-B 1 0110 0110 sw, co, ng, cb
A|B 0 1110 1110 or, om, ls, is
A|~B 0 1101 1101 bc, oc
A&B ... |
#include <bits/stdc++.h> using namespace std; int B[300000]; pair<int, int> A[300000]; stack<pair<int, int> > s; queue<pair<pair<int, int>, int> > q; int main() { int N, l, f, i; long long ta = 0, tb = 0; scanf( %d , &N); for (i = 0; i < N; ++i) scanf( %d , &A[i].first), A[i].second = ... |
//re-order buffer did three things
//In dispatch, unless ROB is full, allocate new ROB entry for incoming instruction at tail, increase the tail
//during the recovery time (when dec_tail|recover is 1), the ROB will not allocate new entry for instructions in dispatch stage
//In complete, if the completed instruction i... |
#include <bits/stdc++.h> using namespace std; long long int par[4000]; long long int sub[4000]; long long int n; vector<long long int> adj[4000]; long long int dp[4000][4000]; long long int conec[4000][4000]; void dfsc(long long int node, long long int cur, long long int dir, long long int p... |
#include <bits/stdc++.h> using namespace std; template <class T, size_t N> ostream& operator<<(ostream& os, const array<T, N>& v); template <class T1, class T2> ostream& operator<<(ostream& os, const pair<T1, T2>& p) { return os << ( << p.first << , << p.second << ) ; } template <class T> ostr... |
module eim_burstcnt(
input wire bclk,
// sync to bclk
input wire [15:0] bus_ad, // raw mux data
input wire [2:0] bus_a, // high address bits
input wire adv, // active high, so connect to !EIM_LBA
input wire rw, // low = write, high = read, so connect to EIM_RW
input w... |
// (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... |
/**
* 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 maxn = 1000 * 100 + 5; int n, l, k; long long a[maxn]; void input() { scanf( %d %d , &n, &l); for (int i = 0; i < n; i++) scanf( %lld , &a[i]); scanf( %d , &k); } long long first() { long long javab = 0, MAX = 0, x; int y; set... |
`include "riscv_functions.vh"
module riscv_ex (
input clk,
input rstn,
//Downstream
input id_ex_rdy,
output id_ex_ack,
//ID input
input [`EX_FUNCT_W-1:0] id_ex_funct,
input [31:0] i... |
#include <bits/stdc++.h> using namespace std; struct pt { long long x; long long y; }; pt u; bool cmp(pt a, pt b) { return a.x < b.x || (a.x == b.x && a.y < b.y); } bool cw(pt a, pt b, pt c) { return a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y) < 0; } bool ccw(pt a, pt b, pt c) ... |
/*
* 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: 10:44:40 01/18/2017
// Design Name: bi_directional_shift
// Module Name: /home/aaron/Git Repos/CSE311/lab1/bi_directional_shift_tb.v
// Project Name: lab1
// Target ... |
/******************************************************************************
* License Agreement *
* *
* Copyright (c) 1991-2013 Altera Corporation, San Jose, California, USA. *
... |
/******************************************************************************/
/* FPGA Sort for VC707 ArchLab. TOKYO TECH */
/* Version 2014-11-26 */
/****************************************************************************... |
#include <bits/stdc++.h> using namespace std; int abs(int x) { if (x < 0) return -x; return x; } int n, m; int x[500], y[500], l[500]; bool used[500]; int placed[500]; int dist(int i, int j) { return abs(x[i] - x[j]) + abs(y[i] - y[j]); } int main() { cin >> n >> m; for (int i = 0; i <... |
#include <bits/stdc++.h> const long long INF = 1000 * 1000 * 1000 + 47; const long long LINF = INF * (long long)INF; using namespace std; const int mod = 1000 * 1000 * 1000 + 9; const int MAX = 100005; pair<int, int> pts[MAX]; int n, k; struct node { int x, y, l, r; int dp0, dp1; node() { l ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using uint = unsigned int; using ull = unsigned long long; template <class T> bool set_max(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template <class T> boo... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 15:28:08 04/19/2015
// Design Name:
// Module Name: display_to_hex
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:... |
#include <bits/stdc++.h> using namespace std; const int N = 1000010; int tree[4 * N]; int n, m; void update(int root, int lo, int hi, int u, int v) { if (v < lo || u > hi) return; if (u <= lo && hi <= v) { tree[root]++; return; } int mid = (lo + hi) / 2, left = root * 2, right = le... |
module vgagfx(input clk, // system clock (100mhz)
input rst,
input clk25mhz, // vga pixel clock (25.13MHz)
input [7:0] vmem_data,
output [19:0] vmem_addr,
output scan,
... |
#include <bits/stdc++.h> template <class C, class E> inline bool contains(const C& container, const E& element) { return container.find(element) != container.end(); } template <class T> inline void checkmin(T& a, T b) { if (b < a) a = b; } template <class T> inline void checkmax(T& a, T b) { ... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:16777216 ) using namespace std; const int MX = 1 << 23; int a, b, c, d, i, j, n, m, k; int lenl[MX + 1], lenr[MX + 1], cnt[MX + 1], len[MX + 1], num[MX + 1]; pair<int, int> sm[MX + 1]; map<int, int> onwork; inline int create(int l, int r) { sm... |
/**
* 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<string> s(3e5 + 1); vector<pair<int, int>> p; int n; vector<pair<int, int>> q; int Kr(int kb, int kn) { int ans = 0; for (int i = 0; i < n; i++) { int r1 = q[i].first - kb; int r2 = q[i].second - kn; int r; if (r1 * r2 >= 0... |
#include <bits/stdc++.h> using namespace std; int n; string s; vector<int> pos[26]; int xd[26]; int main() { cin >> s; n = s.size(); for (int i = 0; i < n; i++) { pos[s[i] - a ].push_back(i); xd[s[i] - a ]++; } double ans = 0; for (char c = a ; c <= z ; c++) { i... |
#include <bits/stdc++.h> using namespace std; int32_t main() { ios::sync_with_stdio(0); cin.tie(0); long long n; cin >> n; long long ar[n + 1]; for (long long i = 1; i <= n; i++) { cin >> ar[i]; } ar[0] = 0; long long ans = 0; for (long long i = 0; i < n; i++) { l... |
/////////////////////////////////////////////////////////////////////
//// ////
//// Non-restoring unsinged divider ////
//// ////
//// Author: Richard Herveille ... |
#include <bits/stdc++.h> using namespace std; template <class T> inline T re() { T N = 0; char c = getchar(); bool neg = 0; for (; c < 0 || c > 9 ; c = getchar()) neg |= c == - ; for (; c >= 0 && c <= 9 ; c = getchar()) N = (N << 3) + (N << 1) + c - 0 ; return neg ? -N : N; } c... |
#include <bits/stdc++.h> using namespace std; int head, tail, n, q[100100]; long long f[100100], a[100100], b[100010]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %I64d , &a[i]); for (int i = 1; i <= n; i++) scanf( %I64d , &b[i]); f[1] = 0; head = tail = 1; q[head] ... |
// (C) 2001-2017 Intel Corporation. All rights reserved.
// Your use of Intel 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 docum... |
#include <bits/stdc++.h> using namespace std; int n, m, deg[8012], ans1, ans2, ans3, cn = 0, mx[8012], X[8012]; bool w[8012][8012], vis[8012]; queue<int> q; long long ans = 0; int main() { scanf( %d , &n); m = n >> 2; int i, j, k, v, x, y, o; char ch; for (i = 0, getchar(); i < n; ++i, g... |
#include <bits/stdc++.h> using namespace std; using INT = long long; int edge[2222][2222]; int deg[2222]; int n; char s[2222]; int id[2222]; int ok() { for (int i = 1; i <= n; i++) id[i] = i; sort(id + 1, id + n + 1, [&](int u, int v) { return deg[u] < deg[v]; }); for (int i = 1, sum = 0; i ... |
#include <bits/stdc++.h> using namespace std; int is[1010]; int main() { int n; scanf( %d , &n); int x = 0; for (int i = (0); i < (n); ++i) for (int j = (0); j < (n); ++j) { int v; scanf( %d , &v); if ((i == j) && (v == 1)) x ^= 1; } int q; scanf( %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... |
//Legal Notice: (C)2017 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 associate... |
#include <bits/stdc++.h> using namespace std; int dp[2010][2010], a[2010]; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int main() { int n, i, j, ans, mn, cnt; scanf( %d , &n); cnt = 0; for (i = 0; i < n; i++) { scanf( %d , a + i); if (a[i] == 1) cn... |
#include <bits/stdc++.h> using namespace std; double tux, pur, foo, bar, baz, quz = 1; int main() { cin >> tux; for (int i = 1; i <= tux; i++) { cin >> pur; foo += pur; bar++; if (foo * quz > baz * bar) { baz = foo; quz = bar; } } printf( %.6lf , baz /... |
#include <cstdio> #include <vector> #include <cstring> #include <algorithm> const int Maxn=200000; const int Inf=0x3f3f3f3f; int n; int a[Maxn+5]; std::vector<int> v_lis[Maxn+5]; struct Segment_Tree{ struct Segment_Node{ int minn,maxn; int lazy; }seg[Maxn<<2|5]; void update_tag(int ro... |
#include <bits/stdc++.h> using namespace std; int grid[500][500]; int srow[500][500]; int scircle[500][500]; int rmaxcircle[500][500 + 1]; int cmaxcircle[500][500 + 1]; int width[((500 - 1) / 2) + 1]; int separation[2 * ((500 - 1) / 2) + 1]; int skip_whitespace() { int ch; while (true) { ... |
#include <bits/stdc++.h> using namespace std; int main() { int mod = 1e9 + 7; string S; cin >> S; bool flag = false; long ans = 0; long plus = 0; for (int i = 0; i < S.size(); i++) { if (S[i] == a ) { if (flag) { ans = (2 * ans + 1) % mod; } else { ... |
#include <bits/stdc++.h> using namespace std; void err(istream_iterator<string> it) {} template <typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cerr << *it << = << a << n ; err(++it, args...); } long long powMod(long long x, long long y) { long lon... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.