text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); const double eps = 1e-10; const int MOD = 998244353; const int INF = 0x3f3f3f3f; const int maxn = 1e3 + 10; const int maxm = 2e5 + 10; char s[maxn]; int len, arr[maxn]; pair<int, long long> dq[maxn]; int main() { scanf... |
#include <bits/stdc++.h> using namespace std; using namespace std; template <typename T, typename U> std::istream& operator>>(std::istream& i, pair<T, U>& p) { i >> p.first >> p.second; return i; } template <typename T> std::istream& operator>>(std::istream& i, vector<T>& t) { for (auto& v : t... |
#include <bits/stdc++.h> using namespace std; const long long MOD = LLONG_MAX; long long gcd(long long x, long long y) { if (y == 0) return x; else return gcd(y, x % y); } long long power(long long x, unsigned long long y) { long long res = 1; x = x % MOD; if (x == 0) return 0;... |
#include <bits/stdc++.h> #pragma GCC optimize(2) using namespace std; void qread(int &x) { int neg = 1; x = 0; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) neg = -1; c = getchar(); } while (c >= 0 && c <= 9 ) x = 10 * x + c - 0 , c = getchar(); x *= ne... |
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-9; const int INF = 1 << 28; const long long INFL = 1LL << 62; int toi(string x) { int z; istringstream iss(x); iss >> z; return z; } string str[] = { YES , NO }; int modulo(int m, int n) { return m >= 0 ? m % n : (n - a... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:667772160 ) using namespace std; struct __isoff { __isoff() { if (0) freopen( input.txt , r , stdin), freopen( output.txt , w , stdout); srand( C + T + A + C + Y + M + B + A ); } ~__isoff() {} } __osafwf; const un... |
//This module implements a register file with enough ports to be
//relatively extensible. (namely, it has two)
module registerfile(
clk,
rst,
as1,
bs1,
cs1,
cw1,
cd1,
as2,
bs2,
cs2,
cw2,
cd2,
AD1,
BD1,
CD1,
WT1,
AD2,
BD2,
CD2,
WT2
);
input clk;
input rst;
//First port:
input [2:0] as1;
input [2:0]... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); bool flag = true; for (int i = 0; i < n; i++) { if (i == 0) { int l = a[1]; int r = a[2]; if (a[i] >= l + r) flag =... |
//======================================================================
//
// fltcpu.v
// --------
// Top level file of the fltfpga cpu.
//
// For instruction format and details of the CPU see the
// fltcpu.md document.
//
//
// Author: Joachim Strombergson
// Copyright (c) 2015 Secworks Sweden AB
// All rights reserv... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e7 + 7; const int mod = 998244353; const long long INF = 1e18; long long jc[maxn]; long long n, k; long long inv2 = 499122177; void init() { jc[0] = 1; for (long long i = 1; i < maxn; i++) jc[i] = jc[i - 1] * i % mod; } long lon... |
// -*- Mode: Verilog -*-
// Filename : uart_tasks.v
// Description : UART Tasks
// Author : Philip Tracton
// Created On : Mon Apr 20 16:12:43 2015
// Last Modified By: Philip Tracton
// Last Modified On: Mon Apr 20 16:12:43 2015
// Update Count : 0
// Status ... |
/**
* 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) 2020-2021 The SymbiFlow Authors.
//
// Use of this source code is governed by a ISC-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/ISC
//
// SPDX-License-Identifier:ISC
module top (
input clk,
output [3:0] led,
inout out_a,
output [1:0]... |
#include <bits/stdc++.h> using namespace std; int main() { int a; cin >> a; while (a--) { int b, c; cin >> b >> c; int arr1[b], arr2[c]; set<int> check; for (int j = 0; j < b; j++) { cin >> arr1[j]; check.insert(arr1[j]); } int x = -1; for ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int x, y, z; long long int x1, y1, z1; cin >> x >> y >> z >> x1 >> y1 >> z1; long long int a[6]; for (long long int i = 0; i < 6; i++) cin >> a[i]; ... |
import "DPI-C" context function int init_socket();
import "DPI-C" context function void close_socket();
import "DPI-C" context function void senduart(input bit[7:0] in);
import "DPI-C" context function bit[8:0] recuart();
module simuart(input wire clk,
input wire cs,
input wire [31:0] bus_addr,
... |
#include <bits/stdc++.h> using namespace std; const int MAXINT = 2147483647; const long long MAXLL = 9223372036854775807LL; const int MAX = 400000; long long n, q, col, pref[MAX], l, r, sum, ans, t[MAX]; string s; int main() { cin >> n >> q; cin >> s; for (int i = 0; i < n; i++) { if (s[... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> arr(n); for (int i = 0; i < n; ++i) cin >> arr[i]; sort(arr.begin(), arr.end()); int i = 0, j = n - 1; vector<int> left; vector<int> right; while (i <= j) { right.push_back(arr[j--]); ... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved.
//
// In this HDL repository, there are many different and unique modules, consisting
// of... |
#include <bits/stdc++.h> using namespace std; const long long N = 1011; const long long INF = 5e16; namespace IO { inline long long read() { long long x = 0; bool f = 0; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) f ^= (ch == - ); for (; isdigit(ch); ch = getchar()) x = x * ... |
//
// Copyright 2011 Ettus Research 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 3 of the License, or
// (at your option) any later version.
//
// This program is dis... |
`define AUTO_NBR_A_INST 2
module autoinst_crawford_array(/*AUTOARG*/
// Outputs
a_valid, a_data,
// Inputs
a_ready, clk, rst_n
);
// a interface
output [`... |
//
// Generated by Bluespec Compiler, version 2021.07 (build 4cac6eb)
//
//
// Ports:
// Name I/O size props
// mv_read O 64
// mav_write O 64
// mv_sie_read O 64
// mav_sie_write O 64
// CLK ... |
#include <bits/stdc++.h> using namespace std; const int INF = 1 << 30; int main() { ios::sync_with_stdio(false); long long int MOD = 1000000007LL; string start, end; int k; while (cin >> start >> end >> k) { const int N = static_cast<int>(start.size()); pair<long long int, long lon... |
`timescale 1ns / 1ps
`default_nettype none
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10/15/2015 08:47:07 AM
// Design Name:
// Module Name: SerialServo
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
/... |
/**
* 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... |
//
// Copyright 2011 Ettus Research 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 3 of the License, or
// (at your option) any later version.
//
// This program is dis... |
#include <bits/stdc++.h> using namespace std; int32_t main() { int n, h; cin >> n >> h; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; int lo = 0; int hi = n - 1; int ans, mid; while (lo <= hi) { mid = lo + (hi - lo) / 2; vector<int> a(mid + 1); for (int... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
/**
* Copyright 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 = 10050; const int D = 600050; const int M = 8000050; const int INF = 20000000; int s, t, nds; namespace Maxflow { int dis[D], q[M * 2], f, r, tot = 1; int head[D], to[M], nex[M], fl[M], now[D]; void addedge(int u, int v, int f) { tot++; ... |
#include <bits/stdc++.h> using namespace std; const long double pi = 3.1415926535897932384626433832795l; template <typename T> inline auto sqr(T x) -> decltype(x * x) { return x * x; } template <typename T> inline T abs(T x) { return x > T() ? x : -x; } template <typename T1, typename T2> in... |
#include <bits/stdc++.h> using namespace std; const int N = 500005; struct node { char s[10]; int len, i, v, num, ty; } p[N], q[3][N]; int n, vst[N], tot = 0, s[3] = {0}; int f[3][N] = {0}; struct data { char s[10]; int ty, c[2], len; } ans[N]; int F(char s[10]) { int i, ad = 0; ... |
#include <bits/stdc++.h> using namespace std; long long n, f, a, b; vector<long long> V; long long ans; int main() { scanf( %lld %lld , &n, &f); for (int i = 1; i <= n; i++) { scanf( %lld %lld , &a, &b); if (a >= b) { V.push_back(0); ans += b; } else { if (a *... |
#include <bits/stdc++.h> const int inf = 1e9 + 7; const int md = 1e9 + 7; const double eps = -1e5; using namespace std; int n, ans, x, y; bool a[1001][1001]; bool isin(int x, int y) { return x > 0 && x <= 1000 && y > 0 && y <= 1000; } int main() { cin >> n; for (int i = 0; i < n; i++) { ci... |
/**
* 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 double PI = acos(-1); const double eps = 1e-9; const int inf = 2000000000; const long long infLL = 9000000000000000000; inline bool checkBit(long long n, int i) { return n & (1LL << i); } inline long long setBit(long long n, int i) { return n | (1LL << i... |
#include <bits/stdc++.h> const int N = 1000005; int fa[N], h[N], nxt[N], adj[N], a[N], u, v, t, id[N], Id, ans[N], f[N], n, tot, m; inline int fd(register int x) { return fa[x] == x ? x : fa[x] = fd(fa[x]); } inline void add() { nxt[++t] = h[u], h[u] = t, adj[t] = v, id[t] = Id, nxt[++t] = h[v], h[v] ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 08/06/2014 01:08:23 PM
// Design Name:
// Module Name: seg_scroll_QU
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
// ... |
//*****************************************************************************
// (c) Copyright 2009 - 2013 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
/... |
// Copyright 1986-2018 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2018.2 (win64) Build Thu Jun 14 20:03:12 MDT 2018
// Date : Tue Sep 17 15:49:39 2019
// Host : varun-laptop running 64-bit Service Pac... |
#include <bits/stdc++.h> #pragma GCC optimize(2) using namespace std; const long long INF = 1e17 + 7; const int N = 1e4 + 7; const int M = 5e6 + 7; long long x[N], y[N]; long long ax, ay, bx, by, a, b, t; signed main() { ios::sync_with_stdio(false); cin >> x[0] >> y[0] >> ax >> ay >> bx >> by; ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10:24:03 06/11/2014
// Design Name:
// Module Name: Valid_Monitor
// Project Name:
// Target Devices:
// Tool versions:
// Description: 1. Snooping the state... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 3010; int n; struct edge { int ne, to; edge(int N = 0, int T = 0) : ne(N), to(T) {} } e[MAXN << 1]; int fir[MAXN], num = 0; inline void join(int a, int b) { e[++num] = edge(fir[a], b); fir[a] = num; } int pa[MAXN][MAXN], si... |
// $Id: c_mat_mult.v 5188 2012-08-30 00:31:31Z dub $
/*
Copyright (c) 2007-2012, Trustees of The Leland Stanford Junior University
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions o... |
#include <bits/stdc++.h> using namespace std; int n; char ara[55][55]; bool ok(int i, int j) { if (i >= n || j < 0 || j >= n) return false; if (ara[i][j] == # ) return false; return true; } int main() { while (cin >> n) { for (int i = 0; i < n; i++) { for (int j = 0; j < n; j+... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; stringstream output; inline void eOP(); inline void solve() { int n, x, y; cin >> n >> x >> y; string s; cin >> s; char p = 1 ; long long cnt = 0; for (char c : s) { if (p == 1 && c == 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> void read(int& x) { x = 0; char c; do { c = getchar(); } while (c < 0 || c > 9 ); while (c >= 0 && c <= 9 ) { x = x * 10 + c - 0 ; c = getchar(); } } using namespace std; int n, m, f[1000 + 5][1000 + 5], ans, sum[1000 + 5]; int s[100000... |
module jt_sfg01(
input rst, // pin 25 (MSX 15) RESET
//inout reg [ 7:0] dio, // pins 43-50 IO(MSX 33-40) DATA BUS
output [ 7:0] sfg_dbi, // pins 43-50 IO(MSX 33-40) DATA BUS
input [ 7:0] sfg_dbo, // pins 43-50 IO(MSX 33-40) DATA BUS
input [15:0] addr, // pins 27-42 O (MSX ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:25:45 06/10/2015
// Design Name:
// Module Name: Top
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Rev... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 1e5 + 10, MOD = 1e9 + 7; int n, x[MAX_N], y[MAX_N], ordered_x[MAX_N], ordered_y[MAX_N], x_n, y_n, ans = 1; int fa[MAX_N * 2], node_cnt[MAX_N * 2], edge_cnt[MAX_N * 2]; void init() { scanf( %d , &n); for (int i = 1; i <= n; i++) { ... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline void ckmax(T& x, T y) { x = (y > x ? y : x); } template <typename T> inline void ckmin(T& x, T y) { x = (y < x ? y : x); } namespace Fread { const int SIZE = 1 << 21; char buf[SIZE], *S, *T; inline char getchar() { ... |
module etx(/*AUTOARG*/
// Outputs
tx_active, txo_lclk_p, txo_lclk_n, txo_frame_p, txo_frame_n,
txo_data_p, txo_data_n, cclk_p, cclk_n, chip_nreset, txrd_wait,
txwr_wait, txrr_wait, etx_cfg_access, etx_cfg_packet, etx_nreset,
tx_lclk_div4,
// Inputs
sys_clk, sys_nreset, soft_reset, txi_wr_wait_p, tx... |
//======================================================================
//
// rosc_entropy.v
// --------------
// Fake ring oscillator based 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.
//
//
/... |
#include <bits/stdc++.h> int solve(int n, int m, std::vector<int> const& costs) { int chosen_row_minimum = -1; for (int i = 0; i < n; ++i) { auto min = std::min_element(costs.cbegin() + i * m, costs.cbegin() + i * m + m); if (*min > chosen_row_minimum) { chosen_row_minimum = *min... |
//////////////////////////////////////////////////////////////////////
//// ////
//// WISHBONE SD Card Controller IP Core ////
//// ////
//// sd_fifo_filler.v ... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo_mixed_widths
// ============================================================
// File Name: Sdram_RD_FIFO.v
// Megafunction Name(s):
// dcfifo_mixed_widths
//
// Simulation Library Files(s):
//
// ============... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2018 Xilinx, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
/... |
#include <bits/stdc++.h> using namespace std; int main() { int x, t, a, b, da, db; cin >> x >> t >> a >> b >> da >> db; if (x == 0) { cout << YES << endl; return 0; } for (int i = 0; i < t; i++) { if (a - da * i == x) { cout << YES << endl; return 0; }... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; const long long INF = 4e18 + 42; long long l[N]; char type[N]; void get_stam(long long need, long long &stam, long long &have, long long &ans, long long cost); int main() { ios_base::sync_with_stdio(false); cin.t... |
/**
* 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() { ios_base::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; set<int> vec; for (int i = 0; i < n; i++) { int d; cin >> d; vec.insert(d); } cout << v... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2009 by Wilson Snyder.
package defs;
function automatic integer max;
input integer a;
input integer b;
max = (a > b) ? a : b;
endfunction
function automati... |
#include <bits/stdc++.h> using namespace std; int left_[105], right_[105], mark[105]; int main() { int n, j; std::ios::sync_with_stdio(0); while (~scanf( %d , &n)) { int ans = 0; memset(left_, 0, sizeof(left_)); memset(right_, 0, sizeof(right_)); memset(mark, 0, sizeof(mark)); ... |
#include <bits/stdc++.h> using namespace std; int main() { int t, i, flag; cin >> t; while (t--) { string s1, s2; cin >> s1 >> s2; flag = 0; for (i = 0; i < s1.length(); i++) { if (find(s2.begin(), s2.end(), s1[i]) == s2.end()) flag++; } if (flag == s1.length(... |
/*
* 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; string a; int main() { cin >> a; cout << a; for (int i = a.size() - 1; i >= 0; i--) cout << a[i]; } |
#include <bits/stdc++.h> using namespace std; int main() { long long int T; cin >> T; while (T--) { string s[9]; for (long long int i = 0; i < 9; i++) { cin >> s[i]; } for (long long int i = 0; i < 9; i++) { for (long long int j = 0; j < 9; j++) { if (s[... |
#include <bits/stdc++.h> using namespace std; int n, k, m, x, y, ans; bool b; int main() { scanf( %d%d , &n, &k); ans = n * 2 - k - 1; for (int i = 1; i <= k; i++) { scanf( %d , &m); b = 0; for (int j = 1; j <= m; j++) { scanf( %d , &x); if (j == 1 && x == 1) b = 1;... |
#include <bits/stdc++.h> using namespace std; const int maxn = 105000; const int mod = 1e9 + 7; vector<int> xloc[maxn], po[maxn]; vector<int> side[maxn], blk; long long ans = 1; long long c[maxn][2]; int vis[maxn], vis_cnt; int d[maxn]; long long g[maxn][2][2]; long long f[maxn][2]; void dfs(int... |
#include <bits/stdc++.h> using namespace std; int color[100005]; vector<int> DSK[100005]; int num = 0, block_size; int S[100005], E[100005], c[100005]; struct query { int l, r, k, id; } Q[100005]; void DFS(int u, int pre) { S[u] = ++num; c[num] = color[u]; for (int i = 0; i < DSK[u].size... |
#include <bits/stdc++.h> using namespace std; const int N = 2 * 1e5 + 1; int l[N], r[N], pos[30]; int main() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); string s, t; cin >> s >> t; int n = s.size(), m = t.size(); memset(pos, -1, sizeof pos); for (int i = 0, j = 0; i < n; i++)... |
// -------------------------------------------------------------
//
// File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\controllerHdl\controllerHdl_MATLAB_Function_block.v
// Created: 2014-09-08 14:12:04
//
// Generated by MATLAB 8.2 and HDL Coder 3.3
//
// -------------------------------------------------------... |
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; int t,n,m,f[100005]; int main() { scanf( %d ,&t); while(t--) { memset(f,0,sizeof(f)); scanf( %d%d ,&n,&m); for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) { int x; scanf( %d ,&x); f[i+j]^... |
`timescale 1ns/100ps
`define DEBUG 1
`include "../define.v"
`include "../regfile.v"
`include "../pipeline_CPU.v"
`include "../hilo_reg.v"
`include "../BranchControl.v"
`include "../HazardControl.v"
`include "../ForwardControl.v"
`include "../IF.v"
`include "../IF_ID.v"
`include "../ID.v"
`include "../ID_EX.v"
`include ... |
// 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 : Fri Jan 13 17:35:17 2017
// Host : KLight-PC running 64-bit major release (bu... |
#include <bits/stdc++.h> using namespace std; const int MAXM = 500 + 5; const int MAXN = 500 + 5; const int MAXQ = 300 + 5; const int MAXK = 800 + 5; const int P = 5; const int MOD = 1e9 + 7; int n, m, q, a[MAXN][MAXK]; int inv[P], ans = 1; char buf[MAXM]; int main() { for (int i = 0; i < P; 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 law... |
#include <bits/stdc++.h> using namespace std; int main() { string s, t; long long n; cin >> n; cin >> s; cin >> t; sort(s.begin(), s.end()); sort(t.begin(), t.end()); long long cnt = 0; long long i = 0; long long j = 0; while (i < n && j < n) { if (s[i] <= t[j]) { ... |
#include <bits/stdc++.h> using namespace std; const long double eps = 1e-9; const long double pi = acos(-1.0); const long long inf = 1e+9; const long long inf64 = inf * inf; #pragma comment(linker, /STACK:36777216 ) template <typename T> istream &operator>>(istream &, vector<T> &); template <typename... |
#include <bits/stdc++.h> using namespace std; const int N = 1000010; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } int lcm(int a, int b) { return a * b / gcd(a, b); } struct data { int num; int init; }; bool byNum(const data &left, const data &right) { return left.num > right.num; } bo... |
#include <bits/stdc++.h> using namespace std; vector<vector<long long>> v; map<int, pair<int, int>> mp; int main() { int k; scanf( %i , &k); v.resize(k + 1); for (int i = 1; i <= k; i++) { int x; scanf( %i , &x); v[i].push_back(0); for (int j = 1; j <= x; ++j) { i... |
#include <algorithm> #include <iostream> #include <sstream> #include <string> #include <vector> #include <queue> #include <set> #include <map> #include <cstdio> #include <cstdlib> #include <cctype> #include <cmath> #include <cstring> #include <list> #include <casser... |
#include <bits/stdc++.h> const int MX = 1e6 + 23; const long long MOD = 998244353; int read() { char k = getchar(); int x = 0; while (k < 0 || k > 9 ) k = getchar(); while (k >= 0 && k <= 9 ) x = x * 10 + k - 0 , k = getchar(); return x; } int n, m, c[MX], w[MX]; int a[MX], b[MX];... |
#include <bits/stdc++.h> using namespace std; long long int a[30], b[30]; char s[1000005]; struct st { long long int x, y; } ara[30]; bool comp(struct st x1, struct st x2) { return x1.y < x2.y; }; int main() { long long int i, j, k, l, m, n, ans = 1LL, t; scanf( %lld %lld , &n, &k); scanf(... |
#include<bits/stdc++.h> using namespace std; #define ll long long int int main() { int t; cin>>t; while(t--) { ll n; cin>>n; vector<ll>a(n); for(ll i=0;i<n;i++) { cin>>a[i]; } ll maxi=INT_MIN; ... |
#include <bits/stdc++.h> using namespace std; int main() { int i, x, ans, num, n, fa[2001]; while (scanf( %d , &n) != EOF) { for (i = 1; i <= n; i++) { scanf( %d , &fa[i]); } ans = 1; for (i = 1; i <= n; i++) { num = 1; x = i; while (fa[x] != -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 * b) / gcd(a, b); } long long int dp[200001][18]; void solve() { long long int n... |
#include <bits/stdc++.h> using namespace std; const int nax = 3e5 + 5; long long n, x1, x2; array<long long, 2> c[nax]; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n >> x1 >> x2; for (int i = 0; i < n; i++) cin >> c[i][0], c[i][1] = i; sort(c, c + n); for (int rep = 0; rep... |
/**
* 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> #pragma comment(linker, /STACK:200000000 ) using namespace std; template <typename T> inline T Abs(T x) { return (x >= 0) ? x : -x; } template <typename T> inline T sqr(T x) { return x * x; } template <typename T> string toStr(T x) { stringstream st; st << x... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of ent_a
//
// Generated
// by: wig
// on: Tue Jun 27 05:12:12 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../verilog.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
// $Author: wi... |
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) template <class S, class T> ostream& operator<<(ostream& os, const pair<S, T>& p) { return os << ( << p.first <... |
#include <bits/stdc++.h> using namespace std; #pragma warning(disable : 4996) class BIT { public: vector<int> bit; int size_ = 0; void init(int sz) { size_ = sz + 2; bit.resize(size_ + 2, 0); } void add(int pos, int x) { pos++; while (pos <= size_) { bit[pos]... |
#include <bits/stdc++.h> using namespace std; int x, cnt; int main() { cin >> x; while (x > 0) { if (x % 2 == 1) { cnt++; } x /= 2; } cout << cnt << endl; } |
/* 西江月·证明 即得易见平凡,仿照上例显然;留作习题答案略,读者自证不难。 反之亦然同理,推论自然成立;略去过程Q.E.D.,由上可知证毕。 result of thinking: Pure. 主要是非内、外向树的情形容易遗漏. AC: */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ldouble; template<class T> bool chmin(T &x... |
#include <bits/stdc++.h> using namespace std; inline void read(long long &num) { num = 0; long long f = 1; char c = getchar(); while (!isdigit(c)) { if (c == - ) f = -1; c = getchar(); } while (isdigit(c)) { num = num * 10 + c - 48; c = getchar(); } num *= f;... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.