text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const int maxn = 100123; const int lgn = 20; long long a[maxn], f[maxn][lgn], ans; vector<int> G[maxn]; void dfs(int u, int p, int x) { int w = a[u] >> x & 1; f[u][w] = 1, f[u][w ^ 1] = 0; for (auto& v : G[u]) { if (v != p) { dfs(v, u, ... |
#include <bits/stdc++.h> using namespace std; bool vis[500005]; int low[500005], d[500005], par[500005], rnk[500005], lev[500005], timer; vector<int> adj[500005], tree[500005]; vector<pair<int, int>> edges; map<int, map<int, int>> ed, br; int get(int x) { return (par[x] == x ? x : par[x] = get(par[x])); }... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
/**
* 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... |
`timescale 1ns / 1ps
// This module is a third order delta/sigma modulator
// It uses no multiply only shifts by 1, 2 or 13
// There are only 7 adders used, it takes around 110 LUTs
module hq_dac
(
input reset,
input clk,
input clk_ena,
input [19:0] pcm_in,
output reg d... |
// Accellera Standard V2.5 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2010. All rights reserved.
// local paramaters used as defines
parameter WINDOW_START = 1'b0;
parameter WINDOW_CHECK = 1'b1;
reg r_state;
`ifdef OVL_SYNTHESIS
`else
initial begin
r_state=WINDOW_START;
end
`endif... |
#include <bits/stdc++.h> using namespace std; int main() { int n, i, a, k = 0; vector<int> v; cin >> n; for (i = 0; i < n; i++) { cin >> a; v.push_back(a); } sort(v.begin(), v.end(), greater<int>()); for (i = 0; i <= n - 3; i++) { if (v[i] < v[i + 1] + v[i + 2]) k++; ... |
/**
* 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... |
`default_nettype none
/***********************************************************************************************************************
* Copyright (C) 2016-2017 Andrew Zonenberg and contributors *
* ... |
#include <bits/stdc++.h> using namespace std; int n, m; int main() { scanf( %d%d , &n, &m); long long dp[m + 2]; int now = 0; int c, sum = 0; for (int i = 0; i < m; i++) { scanf( %d , &c); sum += c; dp[i] = sum; } dp[0] = -2147483647; long long ans = -2147483647; ... |
//==================================================================================================
// Filename : CORDIC_FSM_v3.v
// Created On : 2016-10-03 15:59:21
// Last Modified : 2016-10-28 22:39:59
// Revision :
// Author : Jorge Sequeira Rojas
// Company : Instituto Tecnologico ... |
module axi_conduit_merger #(
parameter ID_WIDTH = 1,
parameter DATA_WIDTH = 32,
parameter ADDRESS_WIDTH = 32,
parameter AXUSER_WIDTH = 5
) (
// axi master
output m_awvalid,
output [3:0] m_awlen ,
output [2:0] m_awsize ,
output [1:0] m_awburst,
output [1:0] m_awlock ... |
#include <bits/stdc++.h> using namespace std; vector<int> v[2000]; vector<int> w[2000]; vector<int> z; int f[2000]; int c[2000]; void dfs(int x) { f[x] = 1; for (int i = 0; i < v[x].size(); i++) { if (f[v[x][i]] == 0) dfs(v[x][i]); } z.push_back(x); } void dfs2(int x, int k) { ... |
#include <bits/stdc++.h> using namespace std; const int N = 400005; char a[N]; int n, k, delta, top, st[N]; bool vis[N]; int main() { scanf( %d%d , &n, &k), scanf( %s , a + 1); delta = (n - k) / 2, top = 0; for (int i = 1; i <= n; ++i) { if (a[i] == ( ) st[++top] = i; else {... |
#include <bits/stdc++.h> using namespace std; const int N = 2222; const int INF = 0x3f3f3f3f; int n, m, k, s; int mat[2][N][9], cp[9][9]; void tomin(int &a, int b) { if (a > b) a = b; } void tomax(int &a, int b) { if (a < b) a = b; } void work() { for (int i = 0; i < m; i++) for (i... |
#include <bits/stdc++.h> using namespace std; long long min_val(long long a, long long b) { if (a <= b) return a; else return b; } long long max_val(long long a, long long b) { if (a >= b) return a; else return b; } long long abs(long long a, long long b) { long l... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) { vector<pair<int, int>> st, re; int a, b; int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a >> b; st.emplace_... |
#include <bits/stdc++.h> using namespace std; struct SNM { vector<SNM*> trgs; vector<SNM*> rv_trgs; int stype; bool asgn; bool used; void asgnN() { if (asgn) return; asgn = true; for (vector<SNM*>::iterator i = trgs.begin(); i != trgs.end(); i++) { (*i)->asgnN(); ... |
//////////////////////////////////////////////////////////////////////
//// ////
//// OR1200's Data Cache top level ////
//// ////
//// This file is part of the OpenR... |
/**
* 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) 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)
// ... |
#include <bits/stdc++.h> const long double ACOSPI = (acosl(-1.0)); using namespace std; int main() { int n = 0; int i = 0; int x = 0; long long ans = 0; map<int, long long> m; int a = 0; cin >> n >> x; for (i = 0; i < n; i++) { cin >> a; ans += m[a]; m[x ^ 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... |
/***********************************************************************************************************************
* Copyright (C) 2016 Andrew Zonenberg and contributors *
* ... |
#include <bits/stdc++.h> using namespace std; long long n, ans, a[300123], maxx[300123], minx[300123], box[800123]; void dopart(long long l, long long r) { if (l == r) { ans++; return; } long long mid = (l + r) / 2; dopart(l, mid); dopart(mid + 1, r); maxx[mid] = a[mid], minx[m... |
#include <bits/stdc++.h> int b[100005], a[100005], n, x, A, k; int main() { while (~scanf( %d %d , &n, &k)) { memset(b, 0, sizeof(b)); scanf( %d , &a[1]); x = 2; for (int i = 2; i <= n; i++) { scanf( %d , &A); if (A != a[x - 1]) a[x++] = A; } for (int i = 1; i... |
module msg_rx(
input clk_sys,
input [0:7] data_in,
input data_in_ready,
output reg ready,
output reg r,
output reg w,
output reg in,
output reg pa,
output reg ok,
output reg pe,
output reg en,
output reg cpd,
output reg cpr,
output reg cpf,
output reg cps,
output reg [0:7] a1,
output reg [0:15] a2,
... |
#include <bits/stdc++.h> #define int long long using namespace std; const int MAX = 505; int n, MOD, fact[MAX], C[MAX][MAX], f[2][MAX * MAX]; int getMaxInv(int x) { return (x - 1) * x / 2; } int32_t main() { #ifdef ACM freopen( input , r , stdin); #endif cin >> n >> MOD;... |
/*
* 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() { char str[2020]; long l; cin >> l; cin >> str; int i, j, hs = 0, ts = 0; for (i = 0; i < l; i++) { if (str[i] == H ) hs++; else ts++; str[l + i] = str[i]; } int res = 1000000000; int t; ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2005 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Outputs
\escaped_normal , double__underscore, \9num , \bra[ket]slash/dash-c... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; long long bin_pow(long long x, long long e, long long MOD) { long long res = 1; while (e) { if (e & 1) res = res * x % MOD; e >>= 1; x = x * x % MOD; } return res; } long long p, a, b, x, ans; vector<long long> m[1123456]; long ... |
// Copyright (c) 2002 Michael Ruff (mruff at chiaro.com)
// Michael Runyan (mrunyan at chiaro.com)
//
// 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
/... |
#include <bits/stdc++.h> using namespace std; stack<pair<int, int> > stc; int main() { ios::sync_with_stdio(false); int n, men, i, cur_max, max; cin >> n; cin >> men; stc.push(make_pair(men, 0)); max = 0; for (i = 0; i < n - 1; i++) { cin >> men; if (stc.top().first > men) ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long double a, b, c; cin >> a >> b >> c; vector<int_fast64_t> am; int_fast64_t k = 1, max = pow(10, 9); int_fast64_t f = pow(k, a) * b + c; while (k <= 81 && f <= max) { int_fas... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1000001; vector<int> g[maxn]; int st[maxn], top, num; int col[maxn]; void dfs(int s) { col[s] = 1; num++; for (int i = 0; i < (int)g[s].size(); i++) { if (!col[g[s][i]]) { dfs(g[s][i]); } } } int main() { ... |
/**
* 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 MX = 100000; vector<int> divisors[MX + 10]; int n, last[MX + 10], pos, X; int main() { for (int j = 1; j <= MX; j++) for (int i = j; i <= MX; i += j) divisors[i].push_back(j); cin >> n; for (int j = 1; j <= n; j++) { cin >> X >> p... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-8; const int mod = 1e9 + 7; const int N = 1e6 + 10; const int inf = 1e9; int t, n, k; char s[N]; int cnt[N]; int a[N], b[N]; int main() { ios::sync_with_stdio(false); cin >> t; while (t--) { cin >> n >> k; ci... |
#include <bits/stdc++.h> using namespace std; auto fio = (ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)); int32_t main() { long long n; cin >> n; vector<long long> g(n); for (long long& x : g) cin >> x; vector<vector<long long>> idx(8192); for (long long i = 0; i < n; i++) idx[g[i]].pus... |
#include <bits/stdc++.h> using namespace std; const int MAX = 1e6 + 1; struct node { int ans = 0; int o = 0; int c = 0; node() : ans(0), o(0), c(0) {} node(int x) : ans(0), o((x == 1 ? 1 : 0)), c((x == 1 ? 0 : 1)) {} }; node t[2 * MAX]; int n; node combine(node x, node y) { node cu... |
#include <bits/stdc++.h> using namespace std; int head[2 * 200005], nex[2 * 200005], from[2 * 200005], to[2 * 200005], cnt, n; int sn[200005], num[200005]; long long d[200005], ans; void add(int u, int v) { nex[++cnt] = head[u]; from[cnt] = u; to[cnt] = v; head[u] = cnt; nex[++cnt] = head[... |
#include <bits/stdc++.h> using namespace std; const int mxN = 2e5; const int MOD = 1e9 + 7; template <typename ForwardIterator, typename T> ForwardIterator first_less_than(ForwardIterator first, ForwardIterator last, T value) { auto it = std::lower_bound(first, last, valu... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5; const int LOG = 20; const int CNTSZ = 30; const long long INF = 1e18; const int MOD = 1e9 + 7; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, m, k; cin >> n >> m >> k; vector<pair<long ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; for (int i = 1; i <= n; i++) cin >> a[i]; int c = 0, t = 0; for (int i = 1; i <= n; i++) { if (a[i] < 0) { c++; } else { t++; } } if (t == n || n == 1) { cout... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2015 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
//
/... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2008 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
reg toggle;
initial toggle=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... |
/*
Copyright 2010 David Fritz, Brian Gordon, Wira Mulia
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.
... |
#include <bits/stdc++.h> using namespace std; char s[100005]; int n, k, cnt[20]; bool a[20][20], mark[1 << 17], tmp[1 << 17]; inline void work(int x, int y) { memset(tmp, 0, sizeof(tmp)); for (int i = 1, j, t; i <= n;) { while (i <= n && s[i] - a != x) i++; j = i + 1; t = 0; ... |
// file: clk_wiz_1.v
//
// (c) Copyright 2008 - 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
// laws.
//
// DISCLAIMER
// This disclaimer is not a ... |
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int k; cin >> k; int sz = s.size(); string land; bool equal; int begin, lenth, idx, res = 0, end; for (int i = 0; i < sz; i++) { begin = i; land = ; for (int j = i; j < sz; j++) { ... |
//////////////////////////////////////////////////////////////////////
//// ////
//// spi_shift.v ////
//// ////
//// This file is part of the SPI I... |
#include <bits/stdc++.h> using namespace std; const long long N = 100; long long n, m, dp[N][N], a[N][N], b[N][N], c[N], len; char go[N][N][N]; char str[N << 1]; inline long long read() { long long sym = 0, res = 0; char ch = 0; while (!isdigit(ch)) sym |= (ch == - ), ch = getchar(); while ... |
#include <bits/stdc++.h> using namespace std; const int N = 200010; struct E { int to, nxt; } e[N << 1]; int n, m, head[N], cnt, l[N], r[N], ans[N], ans_cnt, fa[N]; bool b[N]; int Write[20], WRI; void judge() { freopen( .in , r , stdin); freopen( .out , w , stdout); } int read() { ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = double; void err(istream_iterator<string> it) {} template <typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cout << *it << = << a << endl; err(++it, args...); } const ll MOD... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 10; struct Node { long long l, r; } dict[maxn]; long long N, s; inline bool check(long long mid) { long long cnt = 0, cost = 0; priority_queue<long long, vector<long long>, greater<long long>> q; for (int 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; char s[3010][3010], t[3010][3010], S[3010], T[3010]; int nxt[3010], len, pos, tl, tr, p[3010], pre[3010][3010], n, len_s[3010]; void change(int id) { int n = strlen(s[id] + 1), j = 0; for (int i = 1; i <= n; i++) { while (j && S[j + 1] != s[id][i]) j =... |
#include <bits/stdc++.h> using namespace std; int n, cnt; bool f; vector<int> p, m, z; int main() { scanf( %d , &n); for (int i = 0; i < n; i++) { int x; scanf( %d , &x); if (x < 0) m.push_back(x); if (x > 0) p.push_back(x); if (x == 0) z.push_back(x); } printf( 1... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 15:35:03 06/30/2013
// Design Name: qadd
// Module Name: I:/Projects/xilinx/FPInterface/Tester/Tran3005/Tes_add.v
// Project Name: Trancendental
// Target ... |
#include <bits/stdc++.h> using namespace std; template <class T> string toStr(const T &x) { stringstream s; s << x; return s.str(); } template <class T> int toInt(const T &x) { stringstream s; s << x; int r; s >> r; return r; } const double pi = acos(-1); const double P... |
#include <bits/stdc++.h> using namespace std; int n, s, i, j, k, a, b, w, l1, l2, c, rt, lw; double v[109][109], t[109][109], tp, tc, p1, p2, t1, t2; int main() { cin >> n >> s; for (i = 0; i < n; i++) { cin >> k; for (j = 0; j < k; j++) cin >> v[i][j] >> t[i][j]; t[i][k] = 9999999.0; ... |
#include <bits/stdc++.h> using namespace std; vector<int> v[150005]; int Size[150005]; int forbid[150005]; int val[150005]; vector<int> stk; void dfs(int first, int f) { Size[first] = 1; stk.push_back(first); for (auto it : v[first]) { if (it != f && !forbid[it]) { dfs(it, first)... |
#include <bits/stdc++.h> using namespace std; int n, m; int g[100000], cnt[100000]; int v[100000], b[100000]; int s[100005], sc[100005], sz; bool used[100005] = {}, dead[100005] = {}, marked[100005] = {}; int main() { scanf( %d%d , &n, &m); for (int i = 0; i < (int)(n); ++i) scanf( %d , g + 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 cnt[11], l[11]; int main() { for (int i = 0; i < 6; i++) { scanf( %d , &l[i]); cnt[l[i]]++; } int ok = 0; for (int i = 1; i < 10; i++) if (cnt[i] >= 4) { ok = 1; cnt[i] -= 4; } if (ok) { int a = -1,... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:102400000,102400000 ) using namespace std; const int maxn = 2e5 + 10; const int inf = 0x7fffffff; const long long INF = 9E18; const int mod = 1e9 + 7; const long long mod2 = 1e9 + 9; const int eps = 1e-7; const double pi = acos(-1.0); template... |
// usb.h
`timescale 1 ns / 1 ps
module usb16
(
input clk,
input reset,
// avs_ctrl
input avs_ctrl_address,
input avs_ctrl_write,
input [7:0]avs_ctrl_writedata,
input avs_ctrl_read,
output [7:0]avs_ctrl_readdata,
// asi_uplink
output asi_uplink_ready,
input asi_uplink_valid,
input [15:0]asi_uplink_data... |
// Verilog asynchronous look-up table for LED brightness / gamma correction.
// Copyright (c) 2013 Jared Boone, ShareBrained Technology, Inc.
//
// This file is part of the Medusa project.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License... |
#include <bits/stdc++.h> using namespace std; char s[10010]; int main() { int n; cin >> n; while (n--) { string a; cin >> a; for (int i = 0; i < a.size(); i++) { s[i] = a[i]; } sort(s, s + a.size()); if (s[0] == s[a.size() - 1]) { cout << -1 << endl;... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const int N = 1e6 + 5; inline int readint() { char c = getchar(); int ans = 0; while (c < 0 || c > 9 ) { c = getchar(); } while (c >= 0 && c <= 9 ) { ans = ans * 10 + c - 0 , c = getchar(); } ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; long long n, a, b; cin >> n >> a >> b; set<long long> s; while (a--) { long long j; cin >> j; s.insert(j); } for (long long i = 1; i... |
#include <bits/stdc++.h> using namespace std; int main() { int arr[2], x; cin >> arr[0] >> arr[1] >> x; vector<int> v; int curr = 1; if (x % 2 == 1) { v.push_back(curr); arr[curr]--; curr ^= 1; for (int i = 0; i < x; i++) { v.push_back(curr); arr[curr]--; ... |
// -------------------------------------------------------------
//
// File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\velocityControlHdl\velocityControlHdl_Reset_Delay_block.v
// Created: 2014-08-25 21:11:09
//
// Generated by MATLAB 8.2 and HDL Coder 3.3
//
// -------------------------------------------------... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1000000 + 10; const int MAXM = 600000 + 10; int a[64][64]; int ans, n, m; inline int sg(int x) { return 1 - 2 * x; } inline int sg(int s, int x) { return sg(s >> x & 1); } int main() { ios::sync_with_stdio(false); cin >> n; m = n... |
#include <bits/stdc++.h> int mn(int a, int b) { return a < b ? a : b; } int main() { int a, b; scanf( %d%d , &a, &b); int x = mn(a, b); int ans = 1; for (int i = 2; i <= x; i++) { ans *= i; } printf( %d n , ans); return 0; } |
#include <bits/stdc++.h> using namespace std; int t, n, i, x, y, best, w, cw, rt, a[200200]; vector<int> g[200200]; bool all; void dfs(int i, int p, int cur, int dst) { if (dst > best) { best = dst; cw = cur; w = i; } for (int j : g[i]) if (j != p) { dfs(j, i, ((a[j... |
#include <bits/stdc++.h> using namespace std; long long n, m, d, nn = 0, as[200069], pst[200069], dp[256], mx[256]; pair<long long, long long> a[2][200069]; map<long long, long long> com; int main() { long long i, j, ii, k, p[2], mk, cm = 0, cr = 0, z = -1e18; scanf( %lld%lld%lld , &n, &m, &d); co... |
/**
* 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 p = 1e9 + 7; long long read() { long long s = 0; char c = getchar(), lc = + ; while (c < 0 || 9 < c) lc = c, c = getchar(); while ( 0 <= c && c <= 9 ) s = s * 10 + c - 0 , c = getchar(); return lc == - ? -s : s; } void... |
#include <bits/stdc++.h> using namespace std; int n, m; vector<int> g[200010]; int vis[200010], d[200010]; stack<int> his; void dfs(int u, int dd) { his.push(u); d[u] = dd; for (int v : g[u]) { if (!d[v]) dfs(v, dd + 1); else if (d[u] - d[v] + 1 >= ceil(sqrt(n))) { pu... |
#include <bits/stdc++.h> using namespace std; template <typename T> void maxtt(T& t1, T t2) { t1 = max(t1, t2); } template <typename T> void mintt(T& t1, T t2) { t1 = min(t1, t2); } bool debug = 0; int n, m, k; string direc = URDL ; const long long MOD2 = (long long)1000000007 * (long lon... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1000; bool g[MAXN][MAXN]; bool mh[MAXN], mv[MAXN]; bool use[MAXN]; int main() { int n, m; cin >> n >> m; for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; a--; b--; g[a][b] = true; mv[a] = tru... |
/**
* 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... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 18:01:50 03/29/2015
// Design Name:
// Module Name: aluparam_behav
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// ... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4 ) #pragma GCC optimize( unroll-loops ) using namespace std; using i64 = int64_t; using ui64 = uint64_t; template <class A, class B> bool smin(A &x, B &&y) { if (y < x) { x = y; return true... |
#include <bits/stdc++.h> using namespace std; inline void writeln2() { cout << n ; } inline void writeln() { cout << n ; } inline void readln() {} template <typename T> inline void read(T&); template <typename T> inline void priws(T); template <typename T> inline void print(T); void err(vector... |
#include <bits/stdc++.h> const long long seed = 131; const int N = 1000010; char ac[N], bc[N]; int main() { int n; scanf( %d%s%s , &n, ac, bc), n--; for (int i = 0; i < n; i++) { if (bc[i] == N ) bc[i] = S ; else if (bc[i] == S ) bc[i] = N ; else if (bc[i] == E... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-8; const double C = 0.57721566490153286060651209; const double pi = acos(-1.0); const int mod = 1e9 + 7; const int maxn = 1e5 + 10; int a[maxn]; int b[maxn]; int used[maxn]; int main() { int n; scanf( %d , &n); int k = 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... |
`timescale 1ns / 1ps
// `define DEBUG_SLOW
module dmix_dcm(
input wire clk245760_pad,
input wire rst_dcm,
output wire clk245760,
output wire clk491520,
output wire clk983040);
`ifdef DEBUG_SLOW
reg [1:0] mul_counter_ff;
always @(posedge clk245760_pad)
mul_counter_ff <= mul_counter_ff + 2'b1;
... |
/*
* 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 dp[225][1 << 16]; int dx[4] = {0, -1, 0, 1}; int dy[4] = {1, 0, -1, 0}; int tran[4] = {2, 3, 0, 1}; string s[15]; bool visit[15][15][1 << 16]; int n, m, length, backx, backy, startbody, status; struct snake { int x, y, body; } start; bool in(in... |
#include <bits/stdc++.h> using namespace std; const int mod = 1000 * 1000 * 1000 + 7; const int INF = 1000 * 1000 * 1000; const long long LINF = (long long)INF * INF; struct Query { int l, r, ind, k; }; int n, m; int c[100100]; vector<int> adj[100100]; int cnt[100100], bnd[100100]; int ans[100... |
#include <bits/stdc++.h> using namespace std; const unsigned long long p = 31; const unsigned long long m = 1e9 + 7; bool compare(string a, string b) { sort(a.begin(), a.end()); sort(b.begin(), b.end()); int n = a.length(); unsigned long long hash_a = 0, hash_b = 0; unsigned long long p_pow ... |
#include <bits/stdc++.h> using namespace std; int main() { unsigned long long ans = 1e18, n, k; cin >> n >> k; vector<unsigned long long> v; for (unsigned long long i = 1; i <= n; i++) if (n % i == 0) v.push_back(i); for (unsigned long long x : v) if (x < k) ans = min(ans, (n / x) * ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.