text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const int N = 5555; const long long INF = 1e9 + 19; int n; int a[N][3]; bool can[N][3]; int sumH[3]; int cando[3]; void read() { scanf( %d , &n); vector<vector<int> > tmp; tmp.resize(n); for (int i = 0; i < n; i++) { for (int j = 0; j... |
/**
* 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 inf = 0x3fffffff; const int maxn = 110; char a[20]; int k; int main() { scanf( %s , a); cin >> k; int len = strlen(a); for (int i = 0; i < len; ++i) { int p = i; for (int j = 1; j <= k && j + i < len; ++j) if (a[i + ... |
// ghrd_10as066n2_avlmm_pr_freeze_bridge_0_altera_avlmm_pr_freeze_bridge_171_bb3qwvq.v
// This file was auto-generated from altera_avlmm_pr_freeze_bridge_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 17.1 240
`timescale 1 ps / 1 ps
module ghrd_10as066n2_avlmm_pr_fr... |
/**
* 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 law... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, v; int sum = 0; int cnt[10]; memset(cnt, 0, sizeof cnt); cin >> n; while (n--) { cin >> v; cnt[v]++; sum += v; } if (cnt[0] == 0) { cout ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ; long long int n, k; cin >> n >> k; int a[n + 1]; for (int i = (1); i <= (n); i++) cin >> a[i]; long long int d = 1 + 8 * k; long long int x = (long long int)floor(((sqrt(... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; const int MOD = 1e9 + 7; const int INF = 1e9; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); int n, m; cin >> n >> m; int a[n][m], b[n][m]; vector<int> col[n + m], col2[n + m]; in... |
#include <bits/stdc++.h> using namespace std; int main() { int t, s, q, rel_dist, time; cin >> t >> s >> q; int starts = 1; rel_dist = s; while (rel_dist * q < t) { rel_dist = rel_dist * q; starts++; } cout << starts << endl; return 0; } |
//
// Copyright (c) 1999 Steven Wilson ()
//
// This source code is free software; you can redistribute it
// and/or modify it in source code form under the terms of the GNU
// General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option)
// ... |
module periphModule(
input clk_sdram,
input clk_lcd,
input clk_cam,
input reset_n,
//lcd
output [7:0] R,
output [7:0] G,
output [7:0] B,
output HSYNC,
output VSYNC,
output LCD_CLK,
output DE,
//camera
output camera_ref_clk,
input camera_vsync,
input camera_hsync,
input camera_pclk,
input [7:0] camera_data,
/... |
/**
* 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 law... |
#include <bits/stdc++.h> bool sev(int h, int m); using namespace std; int main() { int snooze; cin >> snooze; int h; int m; int n = 0; cin >> h >> m; if (sev(h, m)) { cout << 0 << endl; } else { while (sev(h, m) == false) { if (m >= snooze) { m = m -... |
#include <bits/stdc++.h> int n, c; void p(int a) { if (a <= n) { c++; p(a * 10); p(a * 10 + 1); } } int main() { std::cin >> n; p(1); std::cout << c; } |
(************************************************************************)
(* * The Coq Proof Assistant / The Coq Development Team *)
(* v * INRIA, CNRS and contributors - Copyright 1999-2019 *)
(* <O___,, * (see CREDITS file for the list of authors) *)
(* \VV/ *********... |
module MAIN
(
SYSTEM_CLOCK,
LED,
VGA_HSYNCH,
VGA_VSYNCH,
VGA_OUT_RED,
VGA_OUT_GREEN,
VGA_OUT_BLUE
);
input SYSTEM_CLOCK; // 100MHz LVTTL SYSTEM CLOCK
output [7:0] LED; // User LEDs
output VGA_HSYNCH; // horizontal sync for the VGA output connector
output VGA_VSYNCH; // vertical sync for th... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of inst_be_i
//
// Generated
// by: wig
// on: Wed Jul 19 05:44:57 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../../udc.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
// $Author:... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 101; int n, m; struct price { int p; int au; bool operator<(const price &rhs) const { if (au == rhs.au) return p > rhs.p; return au < rhs.au; } } price[MAX_N]; int main() { scanf( %d%d , &n, &m); for (int i =... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11/14/2014 05:55:17 PM
// Design Name:
// Module Name: eth_dma_aggr
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
... |
`timescale 1ns / 1ps
module dmix_t;
// ins
reg rst;
reg clk;
parameter TCLK = 40;
initial clk = 0;
always #(TCLK/2) clk = ~clk;
reg signal;
reg sck;
parameter TCLK_SCK = 80;
reg mosi;
reg ss;
parameter TclkSPDIF = 40; // 24.576MHz == 192Khz * 32 bit * 2 (biphase)
nkmdhpa uut(
.rst(rst),
.clk245760_pad(clk... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long int n, i, c = 0; cin >> n; long long int a[n]; for (i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); for (i = 0; i < n; i++) { if (a[i] == a[i + 1]... |
#include <bits/stdc++.h> using namespace std; void dfs(int u, int p[], bool mark[]) { mark[u] = true; if (mark[p[u]]) return; dfs(p[u], p, mark); } int main() { int result = 0, cycle = 0; int n; cin >> n; int p[n + 1], b[n + 1], f = 0; bool mark[n + 1]; for (int i = 1; i <= n... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC optimize( unroll-loops ) #pragma GCC optimize( no-stack-protector ) #pragma GCC target( sse,sse2,ssse3,sse3,sse4,popcnt,avx,mmx,abm,tune=native ) using namespace std; namespace output { void __(short x) { cout << x; } void __(unsigned x) { ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; long long n; int main() { cin >> n; if (n == 1) { cout << 0; return 0; } cout << n / 2 - 1 + (n % 2 != 0); 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... |
/*
* 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; using ll = long long; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; using vi = vector<int>; const ll INF = 100000000000ll; const int N = 200005; const int prime = 31; const ll mod = 1000000007; const ld eps = 1e-5; mt1... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n; cout << endl; cin >> k; for (int i = 1; i <= k; i++) { if (n % 10 == 0) { n = n / 10; } else if (n % 10 != 0) { n = n - 1; } } cout << n; return 0; } |
#include <bits/stdc++.h> using namespace std; const int maxn = 2000 + 100; map<pair<long long, long long>, int> rat; int n; pair<long long, long long> px[maxn], py[maxn]; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } int main() { cin >> n; for (int i = 1, a, b, c; ... |
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long t; t = 1; for (long long test = 1; test <= t; test++) { long long n; cin >> n; vector<long long> a; for (long long i = 0; i <= n - 1; i++) { l... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are... |
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); ios_base::sync_with_stdio(0); string x, y; cin >> x >> y; char ans[200]; for (int i = 0; i < x.size(); i++) { if (y[i] == x[i]) { ans[i] = x[i]; } else if (y[i] < x[i]) { ans[i] = y[i]; }... |
//////////////////////////////////////////////////////////////////////////////////
// AXI4CommandDriver for Cosmos OpenSSD
// Copyright (c) 2015 Hanyang University ENC Lab.
// Contributed by Kibin Park <>
// Yong Ho Song <>
//
// This file is part of Cosmos OpenSSD.
//
// Cosmos OpenSSD is free software;... |
#include <bits/stdc++.h> using namespace std; template <class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; } template <class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long n; ... |
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /STACK:256000000 ) template <class T> T sqr(T a) { return a * a; } int n, m, b; long long a[1 << 20]; int was[1 << 20]; struct dr { int mon, pl, zad; int mask; const bool operator<(dr a) const { if (mon < a.mo... |
#include <bits/stdc++.h> int isPerfectSquare(int number) { int iVar; float fVar; fVar = sqrt((double)number); iVar = fVar; if (iVar == fVar) return 1; else return 0; } int main() { int no; scanf( %d n , &no); int a[no]; int max; max = -1000000; for (int ... |
#include <bits/stdc++.h> using namespace std; const int N = 200010, M = 1000010, P = 1e9 + 7; const int inf = 0x3f3f3f3f; const int INF = 0xcfcfcfcf; const double eps = 1e-9, pi = asin(1) * 2; long long read(); int ADD(int a, int b) { return a + b >= P ? a + b - P : a + b; } int MINUS(int a, int b) { re... |
module Rx_Module (CLK, reset, Start, iRX_BUF_FRAME_TYPE, iALERT, iRECEIVE_DETECT, iRECEIVE_BYTE_COUNT,
Tx_State_Machine_ACTIVE, Unexpected_GoodCRC, CC_Busy, CC_IDLE, Data_In, oALERT,
oRECEIVE_BYTE_COUNT, oGoodCRC_to_PHY, oDIR_WRITE, oDATA_to_Buffer);
//inputs declaration
input wire CC_Busy, CC_IDLE;
input ... |
#include <bits/stdc++.h> using namespace std; int main() { int64_t t, a[200005], n; cin >> t; while (t--) { int64_t dem = 1; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + n + 1); for (int i = 1; i < n; i++) { if (a[i] != a[i + 1]) dem++; ... |
#include <bits/stdc++.h> using namespace std; int testnum; struct Point3 { double x, y, z; Point3(double _x = 0, double _y = 0, double _z = 0) { x = _x; y = _y; z = _z; } bool operator==(Point3 other) { return abs(x - other.x) < 1e-9 && abs(y - other.y) < 1e-9 && ... |
#include <bits/stdc++.h> using namespace std; int n, m; int visit[111111]; vector<int> v[111111], mark[111111]; int dfs(int t) { vector<int> v1; int i; for (i = 0; i < v[t].size(); i++) { int u = v[t][i]; if (visit[mark[t][i]] == 0) { visit[mark[t][i]] = 1; int w = dfs(... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<pair<int, int>> sms; int time1, amount1; for (int i = 0; i < n; i++) { cin >> time1 >> amount1; sms.push_back(make_pair(time1, amount1)); } int time = 0; int amount = 0; int maxamount =... |
//Legal Notice: (C)2016 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; int main() { int t; int m, c; int mc = 0, cc = 0; cin >> t; while (t--) { cin >> m >> c; if (m > c) mc++; else if (m < c) cc++; } if (mc == cc) cout << Friendship is magic!^^ ; else if (mc < cc) ... |
// 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... |
// ghrd_10as066n2_avlmm_pr_freeze_bridge_1_altera_avlmm_pr_freeze_bridge_171_yvsimhi.v
// This file was auto-generated from altera_avlmm_pr_freeze_bridge_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 17.1 240
`timescale 1 ps / 1 ps
module ghrd_10as066n2_avlmm_pr_fr... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; const int UNDEF = -1; const long long INF = 1e18; template <typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; } template <typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ?... |
`timescale 1ns / 1ps
`define HALT 1'b1
`define START 1'b0
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 15:19:34 04/28/2015
// Design Name: dualcore
// Module Name: S:/Xilinx/finalproject/dualcore_tb.v
// Project Name: finalproject... |
#include <bits/stdc++.h> using namespace std; int main() { string s; multiset<string> p; cin >> s; for (int i = 0; i < s.size(); i++) { if ((s[i] == < ) || (s[i] == > )) s[i] = ; } istringstream sin(s); multiset<string>::iterator it; string f; while (sin >> f) { ... |
// nios_dut_mm_interconnect_0_avalon_st_adapter_012.v
// This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 15.1 185
`timescale 1 ps / 1 ps
module nios_dut_mm_interconnect_0_avalon_st_adapter_012 #(
parameter ... |
//------------------------------------------------------------------------------
// YF32 -- A small SOC implementation based on mlite (32-bit RISC CPU)
// @Taiwan
//------------------------------------------------------------------------------
//... |
#include <bits/stdc++.h> using namespace std; int n, L, a[1005], b[1005], ans[1005], cc; double dp[1005], dis[1005][1005]; int pre[1005]; inline bool check(double K) { dp[0] = 0; for (int i = 1; i <= n; ++i) { dp[i] = -1e9; for (int j = 0; j < i; ++j) { double v = dp[j] + K * b[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; int main(int argc, char const *argv[]) { int n, q, counts = 0; cin >> n; int s[n]; for (int i = 0; i < n; i++) cin >> s[i]; cin >> q; int l[q], r[q]; for (int i = 0; i < q; i++) cin >> l[i] >> r[i]; int sums[n + 1]; sums[0] = 0; f... |
#include <bits/stdc++.h> using namespace std; class Solution { public: void solve(vector<pair<int, int>>& edges, vector<int>& xs, vector<int>& ys, int n) { vector<vector<int>> graph(n + 1); for (auto& p : edges) { int u = p.first, v = p.second; graph[u].push_back(v)... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
#include <bits/stdc++.h> using namespace std; int inX[1000001] = {0}; int used[1000001] = {0}; vector<int> ans; int main() { int n; scanf( %d , &n); vector<int> given(n, 0); for (int i = 0; i < n; i++) { scanf( %d , &given[i]); inX[given[i]] = 1; used[given[i]] = 1; } ... |
/////////////////////////////////////////////////////////////////////////
// Copyright (c) 2008 Xilinx, Inc. All rights reserved.
//
// XILINX CONFIDENTIAL PROPERTY
// This document contains proprietary information which is
// protected by copyright. All rights are reserved. This notice
... |
#include <bits/stdc++.h> using namespace std; int break_point() { char c; while ((c = getchar()) != n ) ; return 0; } template <typename T> void read_integer(T &r) { bool sign = 0; r = 0; char c; while (1) { c = getchar(); if (c == - ) { sign = 1; ... |
///////////////////////////////////////////////////////////////////////////////
//
// 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... |
/*
########################################################################
Generic Clock Domain Crossing Block
########################################################################
*/
module fifo_cdc (/*AUTOARG*/
// Outputs
wait_out, access_out, packet_out,
// Inputs
clk_in, reset_in, access_in, pa... |
/**
* 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> #define ll long long #define db long double #define x first #define y second #define mp make_pair #define pb push_back #define all(a) a.begin(), a.end() using namespace std; struct Pair { int x; int y; int def_stack; }; bool cmp(Pair &a, Pair &b) { ... |
#include <bits/stdc++.h> using namespace std; void FastIO() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); cout.precision(15); } string fun(string str) { int i, l = str.length(); for (i = 0; i < l; i++) { if (str[i] == + ) str[i] = * ; else s... |
`default_nettype none
package testcase_pkg;
typedef int unsigned uint;
localparam uint SIZE = 8;
typedef enum {ENUM1, ENUM2} enum_t;
endpackage
module testcase_top
(
input testcase_pkg::enum_t top_enum,
input logic [testcase_pkg::SIZE-1:0] top_in,
... |
#include <bits/stdc++.h> using namespace std; int f[201000], l[201000], r[201000]; int n; int a[201000], s[201000]; int top; int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; top = 0; s[top] = 0; a[0] = 0; for (int i = 1; i <= n; i++) { while (a[s[top]] >= a[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; int a[10000], b[10000], f[10000000]; int main() { int n, ans = 0; scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %d , &a[i]); f[a[i]] = 1; } for (int i = 0; i < n; i++) { scanf( %d , &a[i]); f[b[i]] = 1; } for... |
#include <bits/stdc++.h> using namespace std; long long l; long long calc(long long a, long long b, long long c) { long long sum = b + c; long long t = max(a, sum); long long ret = 0; while (t - a + sum - (b + c) <= l) { long long rem = l - (t - a + sum - (b + c)); ret += (rem + 1) * (... |
#include <bits/stdc++.h> using namespace std; const string nameFiles = ; void error(vector<string>::iterator) {} template <typename T, typename... Args> void error(vector<string>::iterator cur_var, T a, Args... args) { cerr << cur_var->substr((*cur_var)[0] == ) << = << a << endl; error(++cur_... |
module range_counter(
/* input */ clk, reset, en,
/* output */ out, empty, full
);
parameter integer MIN = 0;
parameter integer MAX = 255;
parameter integer INC = 1; // increment (per enabled cycle)
input clk, reset, en;
output integer out;
output reg empty; // true for at most one cycle
o... |
/*****************************************************************************
* File : processing_system7_bfm_v2_0_5_arb_wr_4.v
*
* Date : 2012-11
*
* Description : Module that arbitrates between 4 write requests from 4 ports.
*
*****************************************************************************/
`ti... |
//////////////////////////////////////////////////////////////////////
//// ////
//// eth_outputcontrol.v ////
//// ////
//// This file is part of the Ether... |
#include <bits/stdc++.h> using namespace std; vector<pair<long int, long int>> adj[100001]; bool visit[100001] = {}; long int val[100001]; long int ans = 0; void dfs(long int node, long int w) { if (w > val[node]) { return; } ans++; for (long int i = 0; i < (int)adj[node].size(); i++) ... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 7; int memo[2002][10][10][10][10]; int n; int in[2002], out[2002]; int calc(int i, int b1, int b2, int b3, int b4, int floor) { if (i == n && (b1 + b2 + b3 + b4) == 0) return 0; int a[4], load = 0; memset(a, 0, sizeof a); if... |
#include <bits/stdc++.h> using namespace std; int n, u, d, l, r, i, h[10005]; string a; int main() { cin >> n >> a; for (i = 0; i < n; i++) { if (a[i] == 0 ) d = r = l = 1; if (a[i] == 1 || a[i] == 2 || a[i] == 3 ) u = 1; if (a[i] == 1 || a[i] == 4 || a[i] == 7 ) l = 1; ... |
//////////////////////////////////////////////////////////////////////////////////
//
// This file is part of the N64 RGB/YPbPr DAC project.
//
// Copyright (C) 2016-2018 by Peter Bartmann <>
//
// N64 RGB/YPbPr DAC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public ... |
#include <bits/stdc++.h> using namespace std; bool f[10]; char s[100005]; int main() { int n, i, j; scanf( %d , &n); scanf( %s , s); for (i = 0; i < n; i++) { if (s[i] == L ) { for (j = 0; j < 10; j++) if (!f[j]) break; f[j] = 1; } else if (s[i] == R ) { ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int n, k; cin >> n >> k; set<long long int> s; map<long long int, long long int> mp; long long int x; for (long long int i = 0; i < n; i++) { cin >> x; s.... |
/*******************************************************************************
* This file is owned and controlled by Xilinx and must be used solely *
* for design, simulation, implementation and creation of design files *
* limited to Xilinx devices or technologies. Use with non-Xilinx ... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7, N = 2e2 + 10; long long c[8]; int main() { int t; cin >> t; while (t--) { long long x, y; scanf( %lld%lld , &x, &y); for (int i = 1; i <= 6; i++) { scanf( %lld , &c[i]); } for (int i = 1; i <... |
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) f = -1; c = getchar(); } while (c >= 0 && c <= 9 ) { x = (x << 3) + (x << 1) + c - 0 ; c = getchar(); } return x ... |
#include <bits/stdc++.h> using namespace std; struct point { double x, y; double angle; } a[1200000], chs[1200000]; bool cmp1(point a, point b) { if (a.y == b.y) return a.x < b.x; else return a.y < b.y; } bool cmp2(point a, point b) { if (a.angle == b.angle) return a.x ... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; string a, b; map<pair<string, string>, int> m; int f(string aa, string bb) { if (aa == bb) return 2; if (aa.size() % 2) return 1; if (m[{aa, bb}] != 0) return m[{aa, bb}]; string a1, b1, a2, b2; for (int i = 0; i ... |
#include <bits/stdc++.h> using namespace std; set<int> s; vector<vector<int> > v; bool ch[100005]; void go(int i) { ch[i] = true; int z = 0; for (auto it : v[i]) { if (ch[it] == false) { z++; go(it); } } if (z == 0) { s.insert(i); } } void dynamic(... |
#include <bits/stdc++.h> const double PI = acos(-1.0); const int maxn = 1e6; const int INF = 0x3f3f3f; const long long linf = 0x3f3f3f3f3f3f3f3f; const int mod = 1e9 + 7; using namespace std; struct node { int a, b, color; } edge[maxn]; int n, m, ans; int vis[maxn]; vector<int> v[maxn]; void... |
#include <bits/stdc++.h> using namespace std; const long long inf = 1e9 + 7; const long long mxN = 1e5 + 1; vector<long long> dat; long long arr[4000], n; bool dp[2001]; void solve() { cin >> n; n *= 2; long long p = 0, temp = 0; for (long long i = 0; i < n; i++) { cin >> arr[i]; ... |
/*
* File: reg_gprs.v
* Project: pippo
* Designer: kiss@pwrsemi
* Mainteiner: kiss@pwrsemi
* Checker:
* Description:
* Register file: 32 GPRs for Fixed-point function
* Currently there are 3-Read/1-Write port
* Pipelining behavior:
µ±id¶Î¶³½áʱ£¬rfÁ÷Ë®Âß¼½«±£ÁôÉÏÒ»ÅÄ... |
#include <bits/stdc++.h> using namespace std; map<int, int> mp; int a[100010]; int main() { int i = 0, j = 0; int n, m; while (scanf( %d%d , &n, &m) != EOF) { mp.clear(); int f; for (i = 1; i <= n; ++i) { scanf( %d , &f); if (mp.find(f) != mp.end()) { mp[f... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, k; scanf( %lld%lld , &n, &k); if (k > (long long)1e8) { printf( -1 n ); return 0; } long long b = n / (k * (k + 1) / 2); if (b == 0) { printf( -1 n ); return 0; } long long r = 1; for ... |
//-----------------------------------------------------------------------------
// Copyright (C) 2014 iZsh <izsh at fail0verflow.com>
//
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
// at your option, any later version. See the LICENSE.txt file for the text of
// the license.
//--------... |
/**
* 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; string s; long long int n, k; long long int L, R; bool query(long long int l, long long int r) { l = max(1LL, l); r = min(n, r); cout << l << << r << endl; cin >> s; if (s == Bad ) exit(0); if (s == Yes ) { if (l == r) exit(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... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 100; int fen[maxn * 2], d[maxn], n, first[maxn], w[maxn]; pair<int, int> p[maxn]; int N = 1; map<int, int> mp; vector<int> v; inline void upd(int first, int val) { for (int i = first; i < N; i += i & -i) fen[i] = max(fen[i], val); ... |
// -------------------------------------------------------------
//
// File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\Chart.v
// Created: 2014-09-08 14:12:09
//
// Generated by MATLAB 8.2 and HDL Coder 3.3
//
// -------------------------------------------------------------
// --------------------------------... |
// Copyright (c) 2015 CERN
// Maciej Suminski <>
//
// This source code is free software; you can redistribute it
// and/or modify it in source code form under the terms of the GNU
// General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option)
// any late... |
#include <bits/stdc++.h> using namespace std; int n, sum, as, b[100005], len, ia, la; pair<int, int> a[100005]; int main() { cin >> n; for (int i = 0; i < n; ++i) { cin >> a[i].first; a[i].second = i + 1; sum += a[i].first; } sort(a, a + n); la = n / 2; for (int i = 0; ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.