text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int a[5005]; int vals[5005]; int n; long long d[2][5005]; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; vals[i] = a[i]; } sort(vals, vals + n); memset(d, 0, sizeof(d)); int cur = 0, nw = 1; for (int i =... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int n, k; cin >> n >> k; vector<pair<long long, int> > c(n); vector<int> ans(n); for (int i = 0; i < n; ++i) { cin >> c[i].first; c[i].second = i; } set<pair<long long, int> > av;... |
//Legal Notice: (C)2014 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... |
/**
* 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 x, y, n, c; bool check(long long t) { long long ans = 2 * t * t + 2 * t + 1; if (x + t > n) { long long m = x + t - n; ans -= m * m; } if (y + t > n) { long long m = y + t - n; ans -= m * m; } if (x <= t) { ... |
#include <bits/stdc++.h> #define pb push_back #define speed ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0) using namespace std; typedef long long ll; typedef long double ld; typedef vector <ll> vll; typedef pair<ll,ll> pll; typedef vector <pair<ll,ll>> vpll; typedef vector <vll> vvll; ... |
`timescale 1ns / 1ps
module queue_8x9(
input clk,
input reset,
input nchar,
input lchar,
input [7:0] char_i,
input stb_i,
output ack_o,
output [8:0] dat_o,
output full_o,
output empty_o,
output [7:0] occupied_tb, // TEST BENCH ONLY
output [2:0] rp_tb,
output [2:0] wp_tb,
output we_tb
);
reg [8... |
#include <bits/stdc++.h> using namespace std; const int N = 150; const int M = 6e4 + 5; int n, m; struct Node { int a, b; } s[N]; bool cmp(Node a, Node b) { if (a.b > 0 && b.b < 0) return 1; if (a.b < 0 && b.b > 0) return 0; if (a.b > 0 && b.b > 0) return a.a < b.a; return a.a + a.b > ... |
`default_nettype none
`timescale 1ns / 1ps
// The transmitter core provides an ITU V.4-compatible bit-serial interface.
// This core is based on R&D work performed on the XST (Experimental Serial
// Transmitter) project, and has been feature-reduced to meet the SIA's
// needs.
//
// NOTE: TXC output is always idle-low... |
#include <bits/stdc++.h> #pragma comment(linker, /stack:200000000 ) using namespace std; const double PI = acos(-1.0); const double eps = 1e-9; const unsigned long long MOD = 1e9 + 7; const unsigned long long INF = 1e18 + 7; const unsigned long long MAXN = 2e5 + 7; unsigned long long n, m, A, B, C, ans... |
#include <bits/stdc++.h> using namespace std; int main(void) { int n, k; string wall[2]; int water = 0; cin >> n >> k; cin >> wall[0] >> wall[1]; queue<pair<int, int> > q; q.push(make_pair(0, 0)); while (!q.empty()) { queue<pair<int, int> > next; do { pair<int, in... |
#include <bits/stdc++.h> using namespace std; int mnt[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int mntl[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int main() { int y1, y2, m1, m2, d1, d2, i, j, k, l, ans = 0; scanf( %d:%d:%d , &y1, &m1, &d1); scanf( %d:%d:%d , &y2, &m2, &d2);... |
#include <bits/stdc++.h> using namespace std; char a[5004][5004]; int vis[5004] = {0}; int fl = 0; int n; void dfs(int x, int par) { if (fl == 1) return; vis[x] = 1; for (int i = 0; i < n; i++) { if (a[x][i] == 1 && a[i][par] == 1 ) { printf( %d %d %d n , par + 1, x + 1, i + 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... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n0, n1, n2; cin >> n0 >> n1 >> n2; if (n1 == 0 && n2 == 0) { cout << string(n0 + 1, 0 ) << endl; continue; } string result = string(n2 + 1, 1 ); char turn =... |
`include "timescale.v"
module fb_rxmac (MRxClk, MRxDV, MRxD, Reset, inLastSlaveIDPlus1,
RxData, RxValid, RxRamAddr, LastSlaveIDPlus1, DelaySum,
NumbFrameReceived, DistFrameReceived, DelayFrameReceived, DataFrameReceived, DelayDistFrameReceived,
State... |
#include <bits/stdc++.h> using namespace std; char mtx[555][555]; long long comb[555][555]; int n, m, MOD; map<pair<int, int>, long long> dp[555]; long long solve(int col, int empty, int halfempt) { if (empty < 0 || halfempt < 0) return 0; if (col == n) { return empty == 0 && halfempt == 0; ... |
#include <bits/stdc++.h> using namespace std; int n, m, k; vector<long long> v; vector<pair<pair<long long, long long>, long long> > vv; vector<long long> ary; void update(int pos, long long val, int mx) { while (pos <= mx) { ary[pos] += val; pos += pos & -pos; } } long long get(int ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Rose-Hulman Institute of Technology
// Engineer: Adam and Mohammad
// Create Date: 20:22:39 10/24/2015
// Design Name: I2C Shift Register
// Module Name: ShiftRegisterI2C2015fall
// Summary: ... |
#include <bits/stdc++.h> int main() { int q; scanf( %d , &q); while (q--) { long long k; int x; scanf( %lld%d , &k, &x); printf( %lld n , x + 9 * (k - 1)); } return 0; } |
//----------------------------------------------------------------------------
//-- Memoria ROM de 32 x 4
//------------------------------------------
//-- (C) BQ. October 2015. Written by Juan Gonzalez (Obijuan)
//-- GPL license
//----------------------------------------------------------------------------
//-- Ejempl... |
#include <bits/stdc++.h> using namespace std; int N, x[3], y[3], xx, yy, jump[111111]; pair<long long, long long> dist[111111]; long long maxR2[111111], ans = LONG_LONG_MAX; int main() { scanf( %d %d %d %d %d , &N, &x[1], &y[1], &x[2], &y[2]); for (int i = 1; i <= N; i++) { scanf( %d %d , &xx, &... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ii = pair<ll, ll>; int main() { char rep[256], a[256], b[256], d[256]; while (scanf( %[0-9].%[0-9]e%[0-9] n , a, d, b) == 3) { auto len = strlen(d); if (b[0] == 0 ) { if (len == 1 and d[0] == 0 ) pr... |
#include <bits/stdc++.h> using namespace std; const int N_ = 105; int N, M, X, Y; int len(int x) { for (int l = 1, v = 7;; l++) { if (v >= x) return l; v *= 7; } } set<long long> S; bool chk[100]; void dfs(int i, long long p, long long q) { if (p >= N || q >= M) return; if (i... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 5; const int MOD = 1e9 + 7.5; char s[MAXN]; int f[MAXN], n; int main() { scanf( %s , s + 1); n = strlen(s + 1); int preb = 0; for (int i = 1; i <= n; ++i) { f[i] = f[i - 1]; if (s[i] == a ) { f[i] = (f[... |
/**
* 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... |
//----------------------------------------------------------------------------
//-- Prueba de tranmision 1. Se transmite el caracter "K" con cada flanco de
//-- subida en la señal DTR. De esta forma controlamos la transmision desde
//-- el PC
//--
//-- Este circuito CUMPLE con las normas de diseño síncrono
//----------... |
/*
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... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, i, sum = 0, x, count = 0; cin >> n; long long int a[n]; for (i = 0; i < n; i++) { cin >> a[i]; sum = sum + a[i]; } sort(a, a + n); if (sum % 2 == 0) { cout << sum; return 0; } else { ... |
///////////////////////////////////////////////////////////////////////////////
//
// Project: Aurora 64B/66B
// Company: Xilinx
//
//
//
// (c) Copyright 2008 - 2009 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected unde... |
/**
* 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; #define ll long long #define inf 1e18 #define memset(a , b) memset((a) , (b) , sizeof(a)) #define mod 1000000007 #define rep(i , n) for((i) = 0 ; (i) < n ; (i)++) #define N ... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; long long a = 1; for (int i = 1; i <= (3 * n); i++) { a *= 3; a %= 1000000007; } long long b = 1; for (int i = 1; i <= n; i++) { b *= 7; b %= 1000000007; } long long ans = ((... |
#include <bits/stdc++.h> using namespace std; string a, b; long long int mp[10]; long long int x[20]; bool solve(long long int idx, bool isSmall) { if (idx == b.size()) { return true; } long long int start = b[idx] - 0 ; if (isSmall) start = 9; for (long long int j = start; j >= 0; ... |
module gayle_fifo
(
input clk, // bus clock
input clk7_en,
input reset, // reset
input [15:0] data_in, // data in
output reg [15:0] data_out, // data out
input rd, // read from fifo
input wr, // write to fifo
output full, // fifo is full
output empty, // fifo is empty
out... |
/*
* 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 sum(int[][3], int, int); bool valid(int); int main() { int A[3][3]; for (int i = 0; i < 3; ++i) for (int j = 0; j < 3; ++j) cin >> A[i][j]; for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) cout << !(sum(A, i, j) % 2); cout ... |
#include <bits/stdc++.h> using namespace std; int n, T; double p[5555]; int t[5555]; double f[5555][5555]; int main() { cin >> n >> T; for (int i = 0; i < n; i++) { cin >> p[i] >> t[i]; p[i] /= 100; } for (int x = 1; x < t[n - 1]; x++) f[n - 1][x] = f[n - 1][x - 1] + p[n - ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; int n, m; int h[maxn], in[maxn], q[maxn], sg[maxn], sum[maxn], vis[maxn]; vector<int> G[maxn]; int main() { scanf( %d%d , &n, &m); for (int i = 1; i <= n; ++i) scanf( %d , &h[i]); for (int i = 1; i <= m; ++i) { int u, ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 2; const int M = 2e6; const int V = 500; const int mod = 0; const int inf = 2e9 + 3; const long long INF = 1e16; int dp[V + 20][N], n, q, a[N]; int calc(int p, int k) { int ans = 0; while (p <= n) { ans++; p = p + a[... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; int n; cin >> n; int arr[n]; for (int i = 0; i < n; i++) cin >> arr[i]; sort(arr, arr + n); int ok = 0; for (int i = 0; i < n - 1; i++) { if (((long l... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of inst_eg_e
//
// Generated
// by: wig
// on: Mon Mar 22 13:27:29 2004
// cmd: H:\work\mix_new\mix\mix_0.pl -strip -nodelta ../../mde_tests.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2015.4
// Copyright (C) 2015 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1ns/1ps
module ... |
#include <bits/stdc++.h> #pragma GCC optimization( unroll-loops ) #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4 ) using namespace std; const int BASE = 1000000; char what[1 << 20]; pair<int, int> nxt[10][1 << 20]; pair<long long, int> to[10][10]; inline long long Calc(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; void dice() { int x, y; cin >> x >> y; x = max(x, y); vector<string> str; str = { 1/6 , 1/3 , 1/2 , 2/3 , 5/6 , 1/1 }; x = 6 - x + 1; cout << str[x - 1] << endl; } int main() { dice(); } |
// -----------------------------------------------------------------------
//
// Copyright 2004 Tommy Thorn - 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, In... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/*
*
* Copyright (c) 2013
*
*
*
* 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 is distributed in the ... |
//======================================================================
//
// avalanche_entropy.v
// -------------------
// Fake avalanche entropy source. This module SHOULD ONLY be used
// during simulation of the Cryptech True Random Number Generator
// (trng). The module DOES NOT provide any real entropy.
//
//
// ... |
module top;
reg in1, in2, pass, checkc, checkg, checkp;
wire outc, outg, outp;
assign #400 outc = in1 | in2;
or #400 g1(outg, in1, in2);
my_or #400 g2(outp, in1, in2);
initial begin
// $monitor($time,,outc, outg, outp,, in1,, in2);
pass = 1'b1;
checkc = 1'b0;
checkg = 1'b0;
checkp = 1'b... |
module ALU_tb();
reg [15:0] src0, src1;
reg [2:0] ctrl;
reg [3:0] shamt;
wire [15:0] dst;
wire ov, zr;
ALU iDUT(.src0(src0), .src1(src1), .ctrl(ctrl), .shamt(shamt), .ov(ov), .zr(zr), .dst(dst));
initial begin
addChk(16'h0000, 16'h0000);
addChk(16'h0001, 16'h0000);
addChk(16'h0001, 16'h0001... |
#include <bits/stdc++.h> using namespace std; long long mod = 1000000007; long long mod2 = 998244353; long long mod3 = 1000003; long long mod4 = 998244853; long long inf = 1LL << 60; long double pi = 3.14159265358979323846L; double eps = 1e-12; int dh[4] = {1, -1, 0, 0}; int dw[4] = {0, 0, 1, -1}; ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2009 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc=0;
reg [6:0] mem1d;
reg [6:0] mem2d [5:0];
reg [6:0] mem3d [4:0][5:0];
... |
///////////////////////////////////////////////////////////////////////////////
//
// File name: axi_protocol_converter_v2_1_b2s_wrap_cmd.v
//
///////////////////////////////////////////////////////////////////////////////
`timescale 1ps/1ps
`default_nettype none
(* DowngradeIPIdentifiedWarnings="yes" *)
module axi_... |
//wb_test.v
/*
Distributed under the MIT license.
Copyright (c) 2011 Dave McCoy ()
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
u... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int i, a[n]; map<int, pair<int, int> > m; for (i = 0; i < n; i++) { cin >> a[i]; } int vis[n + 1]; memset(vis, -1, sizeof(vis)); for (i... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 7; const int inf = INT_MAX; const long long inff = 5e18; const long long mod = 1e9 + 7; long long f[7]; long long dp[maxn], dp2[maxn]; vector<long long> value = {0, 0, 0, 1, 0, 0, 2, 0, 0, 3}; void update(long long x, long long dd) {... |
#include <bits/stdc++.h> using namespace std; const long long mod = 998244353; int n, m; int a[66], w[66]; long long dp[66][66][66]; int sa, sb, sum; long long inv[10010]; void solve1(int x) { memset(dp, 0, sizeof(dp)); dp[0][0][0] = 1; long long zi, mu; for (int i = 0; i < m; ++i) ... |
#include <bits/stdc++.h> using namespace std; const short maxn = 5000 + 5; const int mod = 1000000000 + 7; int n; short x[maxn], y[maxn]; short d[maxn][maxn]; short md; char col[maxn]; void dfs(int x) { for (int i = 0, _n = (int)(n); i < _n; i++) if (d[x][i] > md) { if (col[x] == col... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2016 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
`define check(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: %m: Wrong parameter valu... |
module cn0363_phase_data_sync (
input clk,
input resetn,
input processing_resetn,
output s_axis_sample_ready,
input s_axis_sample_valid,
input [7:0] s_axis_sample_data,
input sample_has_stat,
input conv_done,
input [31:0] phase,
output reg m_axis_sample_valid,
input m_axis_sample_ready,
output [23:0]... |
// megafunction wizard: %RAM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: disk02.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// =====================... |
/**
* 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() { int t; scanf( %d , &t); while (t--) { int n; scanf( %d , &n); vector<int> sml, big; for (int i = 1, j = n; i < j; i++, j--) { printf( ? %d %d n , i, j); fflush(stdout); char c[5]; scanf( %s... |
`default_nettype none
`include "core.h"
`include "common.h"
module instruction_buffer(
input wire iCLOCK,
input wire inRESET,
input wire iRESET_SYNC,
input wire iEVENT_START,
//Prev
input wire iPREVIOUS_INST_VALID,
input wire [11:0] iPREVIOUS_MMU_FLAGS,
input wire iPREVIOUS_PAGING_ENA,
input wire i... |
#include <bits/stdc++.h> using namespace std; int n, m, maxw; int w[1010]; int b[1010]; int dsu[1010]; int DSU(int u) { return dsu[u] == u ? u : dsu[u] = DSU(dsu[u]); } vector<pair<int, int> > ops[1010]; int dp[1010], newdp[1010]; int main() { scanf( %d%d%d , &n, &m, &maxw); for (int i = 1; i ... |
package mypackage;
bit [7:0] pkg_addr;
bit [7:0] pkg_data;
endpackage
module times ();
time x;
initial x = 33ns; // Note no space
endmodule : times
interface itf #(parameter num_of_cli = 0);
logic blabla;
logic [7:0] addr, data[9];
modport Master(input data, date_delayed, output addr);
endinterfa... |
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; string s; cin >> s; int l = -1, r = -1; for (int i = 0; i < n; i++) { int cnt1 = 0, cnt2 = 0; if (s[i] == a ) ++cnt1; else ++cnt2; for (int j = i + 1; j < n; j++) { ... |
`timescale 1 ns / 1 ps
module axis_bram_reader #
(
parameter integer AXIS_TDATA_WIDTH = 32,
parameter integer BRAM_DATA_WIDTH = 32,
parameter integer BRAM_ADDR_WIDTH = 10,
parameter CONTINUOUS = "FALSE"
)
(
// System signals
input wire aclk,
input wire ... |
//**************************************************************************
// hp_byte.v - single byte buffer for transfers in host to parasite direction
//
// COPYRIGHT 2010 Richard Evans, Ed Spittles
//
// This file is part of tube - an Acorn Tube ULA compatible system.
//
// tube is free software... |
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; string s; cin >> s; bool ans = false; for (int i = 1; i <= n; ++i) for (int start = 0; start < n; ++start) { int jump = 0; int cur = start; while (cur < n && s[cur] == * ) { ... |
#include <bits/stdc++.h> using namespace std; using namespace rel_ops; using ll = int64_t; using Pii = pair<int, int>; using ull = uint64_t; using Vi = vector<int>; void run(); int main() { cin.sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(10); run(); return 0; } ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, p, q; string s; bool can = true; vector<string> vec; int aux = 0; int pos = 0; cin >> n >> p >> q; cin >> s; aux = n; if (n % p == 0) { cout << n / p << endl; for (int i = 0; i < n; i += p) { ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, i, k; cin >> n >> k; string s; cin >> s; int g, t; for (i = 0; i < n; i++) { if (s[i] == G ) { g = i; } else if (s[i] == T ) t = i; } if (g == t) { cout << YES ; return 0; ... |
///////////////////////////////////////////////////////////////////////////////
//
// Project: Aurora 64B/66B
// Company: Xilinx
//
//
//
// (c) Copyright 2008 - 2009 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected unde... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector<int> a(n); vector<long long> f(2000006, -1); for (int i = 0; i < n; i++) { cin >> a[i]; f[a[i]] = i; } long long ans = 1e18, r... |
/*
Copyright (c) 2015-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... |
// Check the various variable bit selects (MSB > LSB).
module top;
parameter [4:1] ap = 4'h8;
parameter [4:1] bp = 4'h7;
parameter [0:-3] cp = 4'h8;
parameter [0:-3] dp = 4'h7;
reg passed;
wire [4:1] a = 4'h8;
wire [4:1] b = 4'h7;
wire [0:0] s0 = 0;
wire [1:0] s1 = 0;
wire [2:0] s2 = 0;
reg [4:1... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10, size = 1 << 20; template <class o> void qr(o &x) { char c = getchar(); x = 0; int f = 1; while (!isdigit(c)) { if (c == - ) f = -1; c = getchar(); } while (isdigit(c)) x = x * 10 + c - 0 , c = getchar(); ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { double n, m, k; cin >> n >> m >> k; if (m == 0) cout << 0 << endl; else if (n / k >= m) { cout << (int)m << endl; } else { double zz = (m - (n / k)); in... |
/* * @Descripttion: * @version: * @Author: 纸月二五 * @Date: 2021-05-11 17:50:44 */ #include<bits/stdc++.h> using namespace std; int num[200010]; long long cal(long long m) { return m * (m - 1) / 2; } int main() { int T; scanf( %d ,&T); while(T --) ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; const int K = 18; long long a[N], tree[N << 2], lazy[N << 2]; vector<int> v[N]; int anc[N][K], h[N], sz[N]; int c[N], pos[N]; int ct; void build(int node, int st, int end) { if (st == end) { tree[node] = c[st]; retur... |
#include <bits/stdc++.h> using namespace std; const int M = 1e9 + 7; const int MAX_N = 1002; int dp_end[MAX_N][MAX_N]; int dp_not[MAX_N][MAX_N]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) { dp_end[0][i] = (i + 1) / 2; dp_not[0][i] = i / 2; } for (int i = 1; i ... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps / 1ps
`include "utils/bus_to_ip.v"
`include "gpio/gpio_core.v"
`include "gpio/g... |
/**
* 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 = 2e4; const int T = 24 * 60 * 60; int was, n, M, add, cnt, ans[N]; vector<int> ind[T]; int main() { scanf( %d%d%d , &n, &M, &add); for (int i = 0; i < (int)(n); i++) { int h, m, s; scanf( %d:%d:%d , &h, &m, &s); ind[s + 60 ... |
#include <bits/stdc++.h> using namespace std; void make_unique(vector<long long> vec) { sort((vec).begin(), (vec).end()); vec.resize(unique((vec).begin(), (vec).end()) - vec.begin()); } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; cin >> t; while... |
/* -----------------------------------------------------------------------
*
* Copyright 2008,2010 Tommy Thorn - 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 Foundatio... |
#include <bits/stdc++.h> const double PI = 3.14159265358979323846; using namespace std; int main() { std::map<int, long long> pairs; std::set<long long> positive; int n; std::cin >> n; std::vector<int> nums(n); for (int i = 0; i < n; ++i) { std::cin >> nums[i]; if (nums[i] > 0)... |
#include <bits/stdc++.h> using namespace std; int n; vector<vector<int> > adj(1e5 + 1); set<int> rem; vector<int> ord; void search(int pred1, int pred2) { if (ord.size() == n) return; int nxt = 0; for (int j = 0; j < 4 && nxt == 0; j++) { for (int k = 0; k < 4; k++) { int x = adj[p... |
#include <bits/stdc++.h> using namespace std; struct point { int x, y; inline bool operator<(const point &a) const { return x < a.x; } } arr[100005]; struct query_tp { int col, l, r, delta; query_tp() {} query_tp(int _col, int _l, int _r, int _delta) { col = _col; l = _l; r... |
module generator(clk, validdata, Readtoa, Readtob, iWriteEnable, iAddress, iReadAddress);
output clk, Readtoa, Readtob, iWriteEnable;
output [7:0] validdata;
output [9:0] iAddress;
output [9:0] iReadAddress;
reloj r1(clk);
inputs d1(validdata, Readtoa, Readtob, iWriteEnable, iAddress, iReadAddress);
endmodule
//Gene... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; if (n == 1 || n == 2 || n == 3) { cout << NO << endl; return 0; } cout << YES << endl; if (n % 2 == 0) { printf( 1 * 2 = 2 n ); printf( 2 * 3 = 6 n ); printf( 6 * 4 = 24 n ); ... |
// ==============================================================
// 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 ... |
#include <bits/stdc++.h> using namespace std; inline long long read() { long long sum = 0, ff = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) { ff = -1; } ch = getchar(); } while (ch >= 0 && ch <= 9 ) { sum = sum * 10 + ch - 48; ch... |
/**
* 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... |
// AXIS_LOOPBACK - For testing the OPED component
// Copyright (c) 2010,2011 Atomic Rules LLC - ALL RIGHTS RESERVED
//
// The purpose of this module is to loopback the AXI4-Stream that is produced
// by the OPED to the stream that is consumed by the OPED. In this way, this
// module can stand-in for the OPED during dev... |
// -*- verilog -*-
// Copyright (c) 2012 Ben Reynwar
// Released under MIT License (see LICENSE.txt)
/*
Implements a butterfly module for a FFT.
Takes complex numbers W, XA, XB and returns
YA = XA + W*XB
YB = XA - W*XB
It can take input no more frequently than once every
two steps. This is so, hopefully, le... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.