text stringlengths 59 71.4k |
|---|
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: sctag_dir_out.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... |
#include <bits/stdc++.h> using namespace std; struct UF { vector<int> par, sz; UF(int n) { sz.resize(n); par.resize(n); for (int i = 0; i < n; i++) sz[i] = 1, par[i] = i; } int find(int x) { if (par[x] == x) return x; return par[x] = find(par[x]); } void unite(i... |
#include <bits/stdc++.h> using namespace std; int n, k, a[101], m; int main() { m = 101; cin >> n >> k; for (int i = 1; i <= n; i++) { cin >> a[i]; if (k % a[i] == 0) m = min(m, k / a[i]); } cout << m; return 0; } |
/*
Copyright (c) 2014-2017 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... |
//-----------------------------------------------------------------------------
// Pretend to be an ISO 14443 tag. We will do this by alternately short-
// circuiting and open-circuiting the antenna coil, with the tri-state
// pins.
//
// We communicate over the SSP, as a bitstream (i.e., might as well be
// unframed,... |
module peripheral_uart(clk , rst , d_in , cs , addr , rd , wr, d_out, uart_tx, ledout );
input clk;
input rst;
input [15:0]d_in;
input cs;
input [3:0]addr; // 4 LSB from j1_io_addr
input rd;
input wr;
output reg [15:0]d_out;
output uart_tx;
output reg ledout=0;
//----------------------------... |
//-------------------------------------------------------------------------------------------------
// SPI slave module: The SPI bus is over-sampled using the FPGA clock to allow the SPI logic run
// in the FPGA clock domain. Note FPGA FPGA clock must be at least 2x the SPI. Clock to synchronize
// the SPI signals us... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e6 + 5; const int INF = 0x3f3f3f3f; const long long mod = 1e9 + 7; int n, k; int a[MAXN]; stack<pair<int, int> > s; int l[MAXN], r[MAXN]; long long cal(int l, int r) { if (l > r || r - l + 1 - k < 0) return 0; int m = (r - l + 1 -... |
module peripheral_mult(clk , rst , d_in , cs , addr , rd , wr, d_out );
input clk;
input rst;
input [15:0]d_in;
input cs;
input [3:0]addr; // 4 LSB from j1_io_addr
input rd;
input wr;
output reg [15:0]d_out;
//------------------------------------ regs and wires-------------------------------
reg [5... |
//==================================================================================================
// Filename : testbench_CORDICArch2.v
// Created On : 2016-10-03 23:33:09
// Last Modified : 2016-10-05 15:59:27
// Revision :
// Author : Jorge Sequeira Rojas
// Company : Instituto Tecn... |
//---------------------------------------------------------------------------
//-- Copyright 2015 - 2017 Systems Group, ETH Zurich
//--
//-- This hardware module 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 ... |
#include <bits/stdc++.h> using namespace std; const int N = 100010; const int INF = 0x3f3f3f3f; const int iinf = 1 << 30; const long long linf = 2e18; const int mod = 1000000007; const double eps = 1e-7; void douout(double x) { printf( %lf n , x + 0.0000000001); } template <class T> void print(T a) ... |
/**
* 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... |
// -*- verilog -*-
//
// USRP - Universal Software Radio Peripheral
//
// Copyright (C) 2007 Corgan Enterprises 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 2 of... |
// (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; int main() { int n, sum = 0, l = -99999999, r = 99999999; scanf( %d , &n); for (int i = 0; i < n; ++i) { int rat, div; scanf( %d , &rat), scanf( %d , &div); if (div == 1) l = max(l, 1900 - sum); else r = min(r, 1899 - ... |
/*
* 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 int arr[100005]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; long long int sum = 0; for (int i = 0; i < n; ++i) { cin >> arr[i]; sum = sum + arr[i]; } if (sum & 1) { cout <<... |
#include <bits/stdc++.h> using namespace std; const int N = 310; int a[N][N], n, p[N], vis[N]; void dfs(int v) { vis[v] = 1; for (int i = 1; i <= n; i++) { if (a[v][i] && !vis[i]) { dfs(i); } } } int main() { int i, j; scanf( %d , &n); for (i = 1; 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; const int MAX = 2e3 + 5; char a[MAX][MAX]; int main() { ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0); int n, m, k; cin >> n >> m >> k; for (int i = (1); i <= (n); ++i) for (int j = (1); j <= (m); ++j) cin >> a[i][j]; int an... |
/**
* 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 = 35; int n, m; int a[MAXN][MAXN]; int part[MAXN][MAXN], partn = 0; long long ans = 0; int x[MAXN][2]; int res[MAXN][MAXN]; int c[MAXN]; int u[MAXN]; void read() { scanf( %d%d , &n, &m); for (int i = 1; i <= n; i++) { char ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int test = 0; test < t; test++) { bool answer = true; int n; cin >> n; vector<int> a(n); vector<int> b(n); for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) cin >... |
#include <bits/stdc++.h> using namespace std; int main() { unsigned long long n, k; cin >> n >> k; unsigned long long lo = 0, hi = min(n / 2, n / k + 1), mid; while (lo < hi) { mid = lo + (hi - lo + 1) / 2; if (mid + mid * k <= n / 2) lo = mid; else hi = mid - 1; ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer: Muhammad Ijaz
//
// Create Date: 05/05/2017 09:31:01 AM
// Design Name:
// Module Name: REGISTER_FILE
// Project Name: RISC-V
// Target Devices:
// Tool Versions:
// ... |
#include <bits/stdc++.h> using namespace std; int n, k, a[111000], s, ans[111000]; int main() { cin >> n >> k; for (register int i = 1; i <= n; i++) { cin >> a[i]; s += a[i]; } if (s % k != 0) { cout << No ; return 0; } int t = s / k; int cnt = 0; for (regi... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100 + 10; const long long inf = 0x3f3f3f3f3f3f3f3f; string s; int a[maxn]; int main() { ios::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { int flag = 0; int n; cin >> n; for (int i = 0... |
#include <bits/stdc++.h> int main() { int n, next = 0; scanf( %d , &n); int a[n], b[n]; for (int i = 0; i < n; i++) { scanf( %d %d , &a[i], &b[i]); } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (a[j] == b[i] && j != i) { next++; a[j] =... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long double PI = acosl(-1.0); const long double E = 1e-15; mt19937_64 rnd(time(0)); long long n, m, r, pr[100001], dp[100001]; pair<long long, pair<long long, long long> > a[100001]; long long binpow(long long h, long lon... |
/*
* 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... |
/////////////////////////////////////////////////////////////////////
//// ////
//// Non-restoring unsigned divider ////
//// ////
//// Author: Richard Herveille ... |
`timescale 1ns / 1ps
`define intN 8
`define addrN 8
`include "primitives.v"
`include "tests_three_reads.v"
`include "array.v"
module tests_three_reads_tb;
`wire(Array, (`addrN, `intN), arr_in);
`wire(Array, (`addrN, `intN), arr_out);
`reg(simple, `addrN, addr1);
`reg(simple, `addrN, addr2);
`reg(s... |
// Copyright 2020-2022 F4PGA 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int x[N], p[N], n, d, ind[N]; long long ans = 0; vector<pair<int, int> > tank; int head, cur; bool cmp(int a, int b) { return x[a] < x[b]; } bool use(int dis) { while (dis) { if (head == (int)tank.size()) return 1; int ... |
// megafunction wizard: %LPM_MULT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: lpm_mult
// ============================================================
// File Name: mul.v
// Megafunction Name(s):
// lpm_mult
//
// Simulation Library Files(s):
// lpm
// =================================================... |
/**
* 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> #pragma GCC target( avx2 ) #pragma GCC optimization( O3 ) #pragma GCC optimization( unroll-loops ) using namespace std; const int maxn = 2e5 + 5; const double PI = 3.14159265358979323846; void solve() { long long n; cin >> n; vector<long long> v(n); set<long long> ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10:12:45 03/30/2016
// Design Name:
// Module Name: MAIN
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependenci... |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: DynamicFocus.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ===============... |
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll INF = 1e18 + 1; const ll mod = 1e9 + 7; vector<vector<ll> > adj; vector<ll> desc, max_n; ll gmnc = INF; void print_vec(vector<ll> vec) { for (int i = 0; i < vec.size(); ++i) { cout << vec[i] << ; } cout << ... |
#include <bits/stdc++.h> using namespace std; int n, m; vector<int> ke[1000010]; bool cx[1000010], visited[1000010]; void dfs(int u) { visited[u] = true; for (int v : ke[u]) if (!visited[v]) dfs(v); } long long c2(int x) { return (1LL * x * (x - 1)) >> 1; } int main() { if (fopen( a.tx... |
//////////////////////////////////////////////////////////////////////
//// ////
//// OR1200's Data Cache top level ////
//// ////
//// This file is part of the OpenR... |
#include <bits/stdc++.h> using namespace std; vector<char> ch1; int main() { string s, str = ; getline(cin, s); for (int i = 0; i < s.length(); i++) { if (s[i] == . ) { ch1.push_back( - ); i = i + 2; continue; } if (s[i] == && s[i + 1] >= 0 && s[i + 1... |
#include <bits/stdc++.h> using namespace std; int Int() { int x; cin >> x; return x; } double din() { double x; cin >> x; return x; } string Str() { string x; getline(cin, x); return x; } char Ch() { char x; cin >> x; return x; } int main() { int h... |
/**
* 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) 2001-2018 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 from any of the foregoing (including device programming or simulation
// files), and any associated ... |
// $Header: /devl/xcs/repo/env/Databases/CAEInterfaces/verunilibs/data/glbl.v,v 1.14 2010/10/28 20:44:00 fphillip Exp $
`ifndef GLBL
`define GLBL
`timescale 1 ps / 1 ps
module glbl ();
parameter ROC_WIDTH = 100000;
parameter TOC_WIDTH = 0;
//-------- STARTUP Globals --------------
wire GSR;
wire G... |
// 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 : Sat May 27 20:55:57 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; const long long int N = 3e5 + 10, N2 = 2e5, delta = 10499, mod = 1e9 + 7, oo = 1e18, LOG = 20, SQ = 300; const long double PI = 3.141592653589793; pair<pair<long long int, long long int>, long long int> p[N]; int32_t main() { ios::sync_wi... |
//////////////////////////////////////////////////////////////////////
//// ////
//// slaveRxStatusMonitor.v ////
//// ////
//// This file is part of the usbhos... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: ff_jbi_sc0_2.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/... |
#include <bits/stdc++.h> using namespace std; const int maxn = (int)1e5 + 1; int n, rt, tot, sz[maxn], bel[maxn], in[maxn], out[maxn], seg[maxn << 1 | 1]; vector<pair<int, int> > e[maxn]; set<int> sp[maxn]; long long ans; void dfs(int u, long long dis, int ori) { sz[u] = 1; ans += dis; bel[u] ... |
module top;
reg passed;
reg [7:0] val;
reg signed [7:0] sval;
real rval;
initial begin
passed = 1'b1;
val = 8'hff;
sval = 8'hff;
/* Check a constant unsigned value cast to signed. */
rval = $itor($signed(8'hff));
if (rval != -1.0) begin
$display("Failed unsigned constant cast to... |
`timescale 1ns / 10ps
module usb_controller_testbench;
reg clk;
reg reset_n;
reg [15:0] panel_switches_raw;
reg rxf_n_raw;
reg txe_n_raw;
reg [7:0] data_bus_in_raw;
wire [7:0] data_bus_out;
wire rd_n;
wire wr_n;
wire data_out_enabl... |
`timescale 1ns/10ps
(* FASM_PARAMS="INV.TA1=XAS1;INV.TA2=XAS2;INV.TB1=XBS1;INV.TB2=XBS2" *)
(* MODEL_NAME="T_FRAG" *)
(* whitebox *)
module T_FRAG (TBS, XAB, XSL, XA1, XA2, XB1, XB2, XZ);
// For the T_FRAG the TBS input is a fake one. It has to be defined to
// keep VPR happy. It is to be connected to TBS inpu... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(15); srand(42u); unsigned int n; unsigned int m; cin >> n >> m; cout << (min(n, m) & 1 ? Akshat : Malvika ) << endl; return EXIT_SUCCESS... |
module test1(
input wire clk,
input wire reset,
input wire enabled,
input wire in,
input wire Start,
input wire Stop,
output wire sda
);
reg start, done, data;
always@( negedge Start or reset )
begin
if(~reset)
begin
start <= 1'b0;
end
else
begin
if( ena... |
#include <bits/stdc++.h> int main() { int t; scanf( %d , &t); while (t--) { int m, n; scanf( %d %d , &n, &m); char s[n][m]; for (int i = 0; i < n; i++) { scanf( %s , s[i]); } int ans = 0; for (int i = 0; i < n; i++) if (s[i][m - 1] == R ) ans++; ... |
`timescale 1ns / 1ps
// nexys3MIPSSoC is a MIPS implementation originated from COAD projects
// Copyright (C) 2014 @Wenri, @dtopn, @Speed
//
// 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 Found... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, i, a[101], x, y; cin >> n; for (i = 1; i <= n; i++) cin >> a[i]; cin >> m; while (m--) { cin >> x >> y; if (x != 1) a[x - 1] += y - 1; if (x != n) a[x + 1] += a[x] - y; a[x] = 0; } for (i = 1; i ... |
module test();
localparam signed snv1 = 4'd1;
localparam signed [2:0] s3v1 = 4'd1;
localparam signed [3:0] s4v1 = 4'd1;
localparam signed [4:0] s5v1 = 4'd1;
localparam signed snv15 = 4'd15;
localparam signed [2:0] s3v15 = 4'd15;
localparam signed [3:0] s4v15 = 4'd15;
localparam signed [4:0] s5v15 = 4'... |
module gpio_rx
#(
parameter GPIO_DATA_WIDTH = 8
)
(
//gpio_wr_interface
input [GPIO_DATA_WIDTH-1:0] gpio_wr_data,
input gpio_wr_par,
output gpio_wr_err,
input gpio_wr_req,
output gpio_wr_ack,
//gpio_fifo_interface
input [GPIO_DATA_WIDTH-1:0] gpio_p2n_data,
output gpio_p2n_r... |
/*
* Milkymist SoC
* Copyright (C) 2007, 2008, 2009, 2010, 2011 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 dis... |
// 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:55 2017
// Host : DESKTOP-I9J3TQJ running 64-bit major re... |
// NeoGeo logic definition (simulation only)
// Copyright (C) 2018 Sean Gonsalves
//
// 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) an... |
#include<bits/stdc++.h> #define maxn 1000000 using namespace std; int n,d; int a[maxn]; long long prod[10]; long long nprod[10]; long long inf=1e15; vector<int> ans[10]; vector<int> nans[10]; bool tk[maxn]; int inv[10]; int mp[10]; int omp[10]; int main() { scanf( %d %d ,&n,&d); ... |
#include <bits/stdc++.h> using namespace std; void fre() { freopen( c://test//input.in , r , stdin); freopen( c://test//output.out , w , stdout); } template <class T1, class T2> inline void gmax(T1 &a, T2 b) { if (b > a) a = b; } template <class T1, class T2> inline void gmin(T1 &a, T2 b) ... |
#include <bits/stdc++.h> using namespace std; int main() { double m, n; double i; cin >> m >> n; double ans = 0; for (i = 1; i <= m; i++) { ans = ans + i * (pow((i / m), n) - pow(((i - 1) / m), n)); } printf( %.9lf , ans); return 0; } |
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2014 Francis Bruno, All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software... |
#include <bits/stdc++.h> using std::cin; using std::cout; using std::string; using std::vector; static const int MOD = 1000000000 + 7; static long long gcd(long long x, long long y) { return (!y) ? x : gcd(y, x % y); } int read_int() { int x = 0, c = 0; c = getchar(); while (c <= 32) c =... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Adam LLC
// Engineer: Adam Michael
//
// Create Date: 17:28:36 09/26/2015
// Design Name: Short Hamming Decoder
// Module Name: NewHammingDecoder
/////////////////////////////////////////////... |
`include "hi_simulate.v"
/*
pck0 - input main 24Mhz clock (PLL / 4)
[7:0] adc_d - input data from A/D converter
mod_type - modulation type
pwr_lo - output to coil drivers (ssp_clk / 8)
adc_clk - output A/D clock signal
ssp_frame - output SSS frame indicator (goes high while the 8 bits are shifted)
ssp_... |
#include <bits/stdc++.h> using namespace std; long long n, k; long long S[1000000] = {}; int main() { cin >> n >> k; for (long long i = 0; i < n; i++) { string s; cin >> s; S[s.size()]++; } string s; cin >> s; long long pass = s.size(); long long sum1 = 1, sum2 = 0;... |
#include <bits/stdc++.h> using namespace std; const int maxN = 100010; int n, m, k, q; vector<int> G[maxN]; int pre[maxN], s[maxN], e[maxN], cnt[maxN], t; bool nroot[maxN]; void dfs(int cur) { s[cur] = ++t; cnt[cur] = 1; for (int i = 0; i < (int)G[cur].size(); i++) { int nxt = G[cur][i];... |
`include "chip_6502_nodes.inc"
module LOGIC (
input [`NUM_NODES-1:0] i,
output [`NUM_NODES-1:0] o);
`include "logic.inc"
endmodule
module chip_6502 (
input clk, // FPGA clock
input phi, // 6502 clock
input res,
input so,
i... |
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(false); int t; cin >> t; while (t--) { string s; cin >> s; int cntR = 0, cntS = 0, cntP = 0; for (int i = 0; i < s.size(); ++i) { if (s[i] == R ) ... |
// **********************************************************************
// $Header: /var/lib/cvs/dncvs/FPGA/dini/fifo/fifo_async_sel.v,v 1.12 2014/09/02 21:51:45 neal Exp $
// **********************************************************************
// $Log: fifo_async_sel.v,v $
// Revision 1.12 2014/09/02 21:51:45 ne... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int n, m, d[N], a[N]; bool flag[N]; bool check(int x) { memset(flag, 0, sizeof(flag)); int cur = x - 1; for (int i = x; i >= 1; i--) { cur = min(cur, i - 1); if (d[i] && !flag[d[i]] && a[d[i]] <= cur) { flag[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... |
#include <bits/stdc++.h> using namespace std; long long n, m; long long dp[1501][1501]; long long a[1510][1501]; long long func(long long here, long long here1) { if (here1 > m) return -999999999999999; if (here1 < 1) return -999999999999999; if (here == n + 1) return 0; long long &ret = dp[he... |
//~ [Project]
//~ name = Counter for Seven-segment display
//~ organization = RAU:Russian-Armenian University
//~ description =
//~ [Autor]
//~ name = Narek Kostanyan
//~ update = 10 September 2017
module Counter7SD(
clock,
reset,
pause,
reverse,
data
);
// I/O pins direction de... |
#include <bits/stdc++.h> using namespace std; int n, s, i, j, k, l, x, y; int a[200010]; struct node { int i; }; bool operator<(node x, node y) { return a[x.i] < a[y.i]; } multiset<node> S; multiset<node>::iterator p, p2; int li[200010]; vector<pair<int, int> > v; int main() { scanf( %d%d ... |
#include <bits/stdc++.h> using namespace std; const long long N = 1e3 + 5; const long long Q = 3e5 + 5; char w[N][N]; char x[Q]; long long l[Q], r[Q]; long long u[Q], d[Q]; long long f[N][N]; long long c[N][N][26]; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ... |
#include <bits/stdc++.h> const int N = 1010, M = 2010; int las[M], nxt[M], to[M], cnt; int l[M], r[M], siz[M], mx[N][N], f[N]; inline void add(int u, int v) { cnt++; to[cnt] = v; nxt[cnt] = las[u]; las[u] = cnt; } int n, m; inline void fmin(int &a, int b) { if (a > b) a = b; } inli... |
// (C) 2001-2016 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 main() { int n; cin >> n; string s; cin >> s; int a[n]; for (int i = 0; i < n; i++) a[i] = s[i] - 48; int c1 = 0; for (int i = 0; i < n; i++) { if (n % 2 && i == n - 1) { if (!a[i]) c1 += 1; } else { if (a[... |
#include <bits/stdc++.h> using namespace std; const long long oo = 1e18; vector<int> dinh; int nn; long long n, m, k, kc[801][801]; vector<pair<long long, pair<long long, long long>>> e; void compress() { sort(dinh.begin(), dinh.end()); dinh.resize(unique(dinh.begin(), dinh.end()) - dinh.begin());... |
/**
* 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; long long calc_gcd(long long a, long long b) { while (true) if (a) b %= a, swap(a, b); else return b; } void foo() { long long A, M; cin >> A >> M; long long gcd = calc_gcd(A, M); A /= gcd; M /= gcd; set<long l... |
#include <bits/stdc++.h> using namespace std; const int N = 1E6 + 5, K = 1E6 + 5, INF = 1E9 + 7; int n, k, c, v, ans = 0, dsu[K]; char s[N]; vector<int> adj[N]; struct node { int l, r, xo; node(int _l = 0, int _r = 0, int _xo = 0) : l(_l), r(_r), xo(_xo) {} int get() { return min(l, r); } in... |
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0), eps = 1e-4; const int inf = ~0U >> 2; int mod = 1e9 + 7; int Pow(int x, long long t) { int r = 1; for (; t; t >>= 1, x = (long long)x * x % mod) if (t & 1) r = (long long)r * x % mod; return r; } const 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 la... |
#include <bits/stdc++.h> using namespace std; long long n, ch, maxx, minn = 10000, k, x, m; long long mass[65][65], temp[8][8]; long long d1[124], d2[124]; long long st1, en1, st2, en2; long long p1[124], p2[124]; long long a[10000]; int main() { cin >> n; for (int i = 0; i < n; i++) { cin... |
/**
* 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 N = 1e4 + 7; const long long M = 1e3 + 7; const long long INF = 1e18; long long n, m, k, a[N], g, r, ans; bool h[N][M], ok; queue<pair<long long, long long> > q; vector<long long> v; int32_t main() { ios_base::sync_with_stdio(false); ... |
#include <bits/stdc++.h> using namespace std; class Solution { int max_free; vector<bool> visited; vector<int> parent; vector<set<int>> children; void dfs(int i) { visited[i] = true; for (int j : children[i]) { if (!visited[j]) { if (i != 0) cout << i << << j <<... |
// -----------------------------------------------------------------------
//
// Copyright 2003 H. Peter Anvin - 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,... |
#include <bits/stdc++.h> using namespace std; long long n, m, k; long long calc(long long nk, long long mk) { return (n / (nk + 1)) * (m / (mk + 1)); } int main() { cin >> n >> m >> k; if (k > n + m - 2) { cout << -1; return 0; } long long nk = min(k, n - 1); long long mk =... |
#include <bits/stdc++.h> typedef long long ll; typedef long double ld; #define fr(i, a, b) for (ll i = a; i < b; i++) #define rf(i, a, b) for (ll i = a; i >= b; i--) typedef std::vector<long long> vi; #define F first #define S second #define fast ios_base::sync_with_stdio(0);... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.