text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; const int maxn = 5000 + 10; int main() { int n, k; int a[maxn]; scanf( %d%d , &n, &k); for (int i = 0; i < n; i++) scanf( %d , &a[i]); int sum = 0; int maxs = 0; double maxa = 0; for (int i = k; i <= n; i++) { for (int j = 0; j < ...
#include <bits/stdc++.h> using namespace std; int read(); const int N = 1.5e5 + 5; int n, p, k, m, a[N]; vector<pair<int, int> > seg[N << 2], res; int eq[N << 2]; void puteq(int k, int l, int r, int v) { eq[k] = v; seg[k].clear(); seg[k].push_back(make_pair(v, r - l + 1)); } bool cmp(const...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 19:41:11 11/25/2009 // Design Name: // Module Name: tetris_blocks // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: ...
/*+-------------------------------------------------------------------------- Copyright (c) 2015, Microsoft Corporation 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 of source code ...
#include <bits/stdc++.h> using namespace std; template <class T1, class T2> istream &operator>>(istream &in, pair<T1, T2> &P) { in >> P.first >> P.second; return in; } template <class T1, class T2> ostream &operator<<(ostream &out, const pair<T1, T2> &P) { out << ( << P.first << , << P.seco...
#include <bits/stdc++.h> using namespace std; const int N = 1e6; vector<long long> v[105]; map<long long, long long> mp; int vis[105]; long long cnt, cnt2; void dfs(int s) { vis[s] = 1; cnt += v[s].size(); cnt2++; for (int i = 0; i < v[s].size(); i++) { if (!vis[v[s][i]]) dfs(v[s][i]...
#include <bits/stdc++.h> using namespace std; struct node { int a, b; node(int a = 0, int b = (int)1e9) : a(a), b(b) {} int get(int x) { return a * x + b; } }; struct Zwei { vector<node> st; vector<int> a; int n; void add(int pos) { a.push_back(pos); } void update() { sort(...
/* * 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; const int maxn = 1e5 + 5; int n, sz[maxn], ans[maxn]; long long sum; vector<int> adj[maxn], vec; void dfs(int u, int par) { sz[u] = 1; for (auto v : adj[u]) if (v != par) { dfs(v, u); sz[u] += sz[v]; } } void DFSend(int u,...
#include <bits/stdc++.h> using namespace std; const int N = 200010; int T, n, m, ans; char s[N], p[N]; int ne[N], len[N]; int main() { scanf( %s , s + 1); m = strlen(s + 1); cin >> T; while (T--) { scanf( %s , p + 1); n = strlen(p + 1); if (n == 1) continue; for (int ...
#include <bits/stdc++.h> using namespace std; long long n, sx, sy, dx, dy, t; struct matrix { long long m[8][8]; matrix() { memset(m, 0, sizeof(m)); } }; matrix mul(matrix a, matrix b) { matrix tmp; for (int i = 1; i <= 6; i++) for (int k = 1; k <= 6; k++) if (a.m[i][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...
//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; long long ans, t, s, a, i, b, k; int main() { cin >> k >> a >> b; s = (0 - a) / k + 1; while (a <= 0) { a = a + s * k; b = s * k + b; } ans = b / k - (a - 1) / k; cout << ans; }
#include <bits/stdc++.h> using namespace std; const int maxn = 1000020; const int maxm = 1000020; const int MOd = 998244353; void solve() { string s; cin >> s; int c = 0, c1 = 0; for (int i = 0; i < s.size(); i++) { if (s[i] == 0 ) { if (!c) printf( 1 1 n ); el...
/** * 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...
// Check that packed arrays of all sorts get elaborated without an error and // that the resulting type has the right packed width. module test; typedef bit bit2; typedef logic [1:0] vector; bit2 [1:0] b; vector [2:0] l; typedef enum logic [7:0] { A } E; typedef E [1:0] EP; typedef EP [2:0] EPP; E e; EP ep1; E ...
`default_nettype none module l1_data_cache_counter( input wire iCLOCK, input wire inRESET, //Hit Infomation input wire iCACHE_VALID, input wire iCACHE_HIT, //Infomation output wire [6:0] oINFO_COUNT ); reg [99:0] b_counter; always@(posedge iCLOCK or negedge inRESET)begin if(!inRESET)begin b_cou...
/************************************** * Module: simul_axi_fifo * Date:2014-03-23 * Author: Andrey Filippov * * Description: ***************************************/ `timescale 1ns/1ps module simul_axi_fifo #( parameter integer WIDTH= 64, // total number of output bits parameter integer LATENCY=0...
#include <bits/stdc++.h> using namespace std; int main() { long long n, d, m; cin >> n >> d >> m; long long ans = 0; long long a[n]; vector<long long> big, small; for (long long i = 0; i < n; i++) cin >> a[i]; for (long long i = 0; i < n; i++) { if (a[i] > m) big.push_back(...
#include <bits/stdc++.h> using namespace std; const int MAXN = 100005; const long long INF = 1e18; const long long MOD = 1000000007; long double A[100005], B[100005]; int main() { int n, p; cin >> n >> p; for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; A[i] = y / p; ...
#include <bits/stdc++.h> using namespace std; const int N = 300010; int n, l[N], t[N]; long long r, dv, res, tcur; vector<long long> ans; void solve(int l, int t) { if (2 * l <= t) { tcur += 2 * l; return; } long long x = t - l; long long tmp = (1ll * l - x + r - 1) / r; res ...
#include <bits/stdc++.h> using namespace std; int n, m, d; vector<int> e[100000 + 5], lst[100000 + 5]; int dfn[100000 + 5], low[100000 + 5], cnt, tot, sta[100000 + 5], ptr, scc[100000 + 5], cycle[100000 + 5]; char open[100000 + 5][55]; void tarjan(int now) { dfn[now] = low[now] = ++cnt; sta[++...
#include <bits/stdc++.h> using namespace std; unordered_set<string> was; int n, i, j, pos, k = 13, t; string codes[1001]; int main() { ios_base::sync_with_stdio(false); cin >> n; for (; i < n; ++i) cin >> codes[i]; for (i = 0; i < n; ++i) for (j = i + 1; j < n; ++j) { t = 0; ...
#include <bits/stdc++.h> using namespace std; char s[100000]; int main() { int m, n, j, k, l, t, ll; bool is = false; cin >> t; cin >> s; if (t < 5) { cout << no << endl; return 0; } l = t / 5; ll = t % 5; for (j = 0; j < t && !is; j++) for (k = 1; k < t && ...
#include <bits/stdc++.h> const int dx[] = {1, 0, -1, 0}; const int dy[] = {0, 1, 0, -1}; using namespace std; const int MAXN = 55; int n; int a[2][MAXN]; int asum[2][MAXN]; int b[MAXN]; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> n; for (int j = 0; j < 2; j++) fo...
/* * Copyright 2013, Homer Hsing <> * * 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 to ...
#include <bits/stdc++.h> using namespace std; int gi() { int x = 0, w = 1; char ch = getchar(); while ((ch < 0 || ch > 9 ) && ch != - ) ch = getchar(); if (ch == - ) w = 0, ch = getchar(); while (ch >= 0 && ch <= 9 ) x = (x << 3) + (x << 1) + ch - 0 , ch = getchar(); return w ...
//---------------------------------------------------------------------------- //-- Limitaciones en la sintesis de puertas triestado //-- Error 2: Conexion de dos registro de 1 bit a un cable de 2 bits //-- a traves de dos puertas triestado. Controlados con la misma //-- señal de enable //------------------------------...
#include <bits/stdc++.h> using namespace std; class mat { public: long long a, b, c, d; }; mat a; long long n, k, l, m, step, res; long long power(long long a, long long b); mat mult(mat a, mat b); mat power1(mat a, long long n); int main() { cin >> n >> k >> l >> m; step = power(2, n);...
// synopsys translate_off `timescale 1 ps / 1 ps // synopsys translate_on module simpledpram (clock, wraddress, wrdata, wren, rdaddress, rddata); parameter DATA_WIDTH = 36; parameter ADDR_WIDTH = 7; parameter INIT_FILE = "somefile"; // No .mif! input ...
`timescale 1ns / 1ps module Coprocessor( clk, rst, c0_rd_addr, c0_wr_addr, c0_w_data, pc_i, InTcause, c0_reg_we, WriteEPC, WriteCause, c0_r_data, epc_o, WriteInt, Int_en_i, Int_en_o ); // ================ IO interface input clk, rst; input wire [31: 0] c0_w_data, pc_i; input wire [ 4: 0] ...
#include <bits/stdc++.h> using namespace std; long long bin_pow(long long a, long long b) { if (b == 0) return 1; if (b % 2 == 0) { long long t = bin_pow(a, b / 2); return t * t % 1000000007; } else return a * bin_pow(a, b - 1) % 1000000007; } vector<long long> graph[500000]; boo...
#include <bits/stdc++.h> #pragma GCC optimize(3) #pragma GCC optimize( Ofast ) #pragma GCC optimize( inline ) using namespace std; const int N = 7005; const int M = 200000; const long long mod = 1e9 + 7; const long long inf = 0x3f3f3f3f; namespace FastIO { template <typename tp> inline void read(t...
#include <bits/stdc++.h> using namespace std; template <class T> inline void read(T& x) { bool fu = 0; char c; for (c = getchar(); c <= 32; c = getchar()) ; if (c == - ) fu = 1, c = getchar(); for (x = 0; c > 32; c = getchar()) x = x * 10 + c - 0 ; if (fu) x = -x; }; template <...
#include <bits/stdc++.h> using namespace std; int n, s, k; vector<int> a; void Input() { cin >> n >> s >> k; a.clear(); a.resize(k); for (auto &z : a) cin >> z; } void Solve() { for (int i = 0; i <= k; i++) { if (s - i >= 1 && find(a.begin(), a.end(), s - i) == a.end()) { c...
#include <bits/stdc++.h> using namespace std; template <class T> inline bool CHMAX(T& a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool CHMIN(T& a, T b) { if (a > b) { a = b; return true; } return false; } constexp...
`include "../led_ctl.v" module test; reg read_n; reg write_n; reg reset_n; reg ce_n; wire [7:0] data; wire [7:0] leds; reg [7:0] write_data; assign data = (~(write_n)) ? write_data : 8'bz; led_ctl led1(read_n, write_n, reset_n, ce_n, data, leds); initi...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2021 Yutetsu TAKATSUKASA. // SPDX-License-Identifier: CC0-1.0 module t(/*AUTOARG*/ // Inputs clk ); input clk; integer cyc = 0; reg [63:0] crc; ...
// zhiyang ong // andrew mattheisen // The next line is only used for module synthesis //`include "~/ee577b/syn/src/control.h" module control(instr, aluop, ww, memEn, memWrEn, maddr, wbyteen, regop, rrdaddra, rrdaddrb, rwraddrd, reginmuxop, aluinmuxop, immediate); // INPUTS input [0:31] i...
// -*- verilog -*- // Copyright (c) 2012 Ben Reynwar // Released under MIT License (see LICENSE.txt) // The suffix _AA is meaningless. module buffer_AA #( parameter WIDTH = 32, parameter MEM_SIZE = 64, parameter LOG_MEM_SIZE = 6 ) ( input wire clk, input wire ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 19:31:14 10/18/2012 // Design Name: // Module Name: dummy_ula // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // ...
#include <bits/stdc++.h> using namespace std; const long long int mod = 1000000000 + 7; const long long int N = 10000000 + 6; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int q; cin >> q; for (int i = 0; i < q; ++i) { long long n; cin >> n; vector<...
#include <bits/stdc++.h> using namespace std; void print(vector<pair<int, int> > &v) { for (int i = 0; i < v.size(); i++) cout << v[i].second << ; cout << endl; } int main() { int n; cin >> n; vector<pair<int, int> > input; for (int i = 0; i < n; i++) { int x; cin >> x; ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, k; cin >> n >> m >> k; if (m >= n && k >= n) { cout << Yes << endl; } else cout << No << endl; }
#include <bits/stdc++.h> using namespace std; const int Maxn = 300005; int res, cnt, head[Maxn], choose[Maxn], target[Maxn], las[Maxn], ct, n[Maxn], k, val[Maxn], a[20][Maxn], b[Maxn], bel[Maxn], state_cnt; bool vis1[Maxn], vis2[Maxn], ans[Maxn], done[20], flag; map<long long, int> Ma; long long sum[M...
/** * 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 1ps / 1ps module image_to_ppfifo #( parameter BUFFER_SIZE = 9 )( input clk, input rst, input axis_clk, input w_axis_rst, input i_enable, input i_video_hsync, input i_sof_stb, input [2:0] i_red, ...
/* * 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...
/* * Milkymist VJ SoC * Copyright (C) 2010 Zeus Gomez Marmolejo <> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3 of the License. * * This program is distributed in the hop...
#include <bits/stdc++.h> using namespace std; const int MAX = 1e6 + 5; const int MOD = 1e9 + 7; int dr[4] = {0, 0, 1, -1}; int dc[4] = {1, -1, 0, 0}; int ddr[8] = {0, 0, 1, -1, 1, -1, 1, -1}; int ddc[8] = {1, -1, 0, 0, 1, -1, -1, 1}; bool isPrime(int n) { if (n <= 1) return false; for (int i = 2...
/* * 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 n, k; const int maxn = 1e5 + 10; stack<int> max_seen; int ans[maxn]; vector<int> to[maxn]; void calc(int a) { int s = max(a - k, 0), t = min(n, a + k + 1); if (max_seen.empty()) ans[a] += t - s; else ans[a] += t - max(max_seen.top()...
//***************************************************************************** // (c) Copyright 2009 - 2012 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 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; int main() { ios_base::sync_with_stdio(0); ; cin >> x >> y; if ((long long)sqrt(x * x + y * y + 0.5) == sqrt(x * x + y * y)) { cout << black << n ; return 0; } long long d = sqrt(x * x + y * y); if...
#include <bits/stdc++.h> using namespace std; int N, R, C, g[110][110]; vector<int> A, B; int main() { scanf( %d %d %d , &N, &R, &C); for (int i = 1; i <= (N); i++) { if (i & 1) A.push_back(i); else B.push_back(i); } for (int r = 1; r <= (R); r++) for (int c = 1...
#include <bits/stdc++.h> using namespace std; const int sigma_size = 26; const int N = 100 + 50; const int MAXN = 100000 + 50; const int inf = 0x3fffffff; const double eps = 1e-8; const int mod = 1000000000 + 7; int n, k; int a[N]; double dp[N][N], res[N][N]; int main() { while (~scanf( %d%d ,...
#include <bits/stdc++.h> using namespace std; const int inf = 1 << 30; const int mod = 998244353; const int maxn = 2005; string s; long long ans = 0; int n; vector<pair<int, int> > edges[maxn]; int col[maxn], vis[maxn]; int isbi = 1; void flood(int x, int curcol) { if (vis[x]) { if (col[...
#include <bits/stdc++.h> using namespace std; const long long inf = 1e15; const int maxn = 5000 + 5; long long cnt[maxn + 10]; long long p[maxn + 10][maxn + 10]; long long pd[maxn + 10]; int main() { memset(cnt, 0, sizeof(cnt)); int n; scanf( %d , &n); for (int i = (1); i <= (n); i++) { ...
#include <bits/stdc++.h> using namespace std; const int N = 5010; int n, m, s; vector<int> e[N]; int low[N], dfn[N], idx; bool vis[N]; stack<int> st; bool in_stack[N]; int color[N], color_tot; int indeg[N]; int ans; void AddEdge(int u, int v) { e[u].push_back(v); } void Dfs(int u) { low[u]...
#include <bits/stdc++.h> using namespace std; int *a; int *b; int n; long long int what(long long x) { long long int s = 0; for (int i = 0; i < n; i++) { s += (x * a[i]) / b[i]; } return s; } int main() { int i, j; int c; cin >> n >> c; a = new int[n]; b = new 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 la...
////////////////////////////////////////////////////////////////////////////////// // BCHEncoderX for Cosmos OpenSSD // Copyright (c) 2015 Hanyang University ENC Lab. // Contributed by Jinwoo Jeong <> // Kibin Park <> // Yong Ho Song <> // // This file is part of Cosmos OpenSSD. // // Cosm...
#include <bits/stdc++.h> using namespace std; inline int nextint() { int res = 0; char c = 0; while (c < 0 || c > 9 ) c = getchar(); while (c >= 0 && c <= 9 ) { res = res * 10 + c - 0 ; c = getchar(); } return res; } int n; long long a[200000], b[200000]; bool good...
#include <bits/stdc++.h> using namespace std; int n, k, ans, now; int v[505][505]; int main() { scanf( %d%d , &n, &k); now = n * n; for (int i = n; i >= 1; i--) for (int h = n; h >= k; h--) v[i][h] = now--; now = 1; for (int i = 1; i <= n; i++) for (int h = 1; h < k; h++) v[i][h]...
#include <bits/stdc++.h> using namespace std; int main() { double s = 0, n; cin >> n; while (n > 0) { s += (1 / n); n--; } cout << s << endl; }
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; int n, m; int a[maxn], b[maxn]; int main() { cin >> n >> m; m--; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { cin >> b[i]; } if (a[0] == 0) { cout << NO ; ...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 16:43:12 03/11/2015 // Design Name: delay // Module Name: /home/vka/Programming/VHDL/workspace/test/tb_delay.v // Project Name: test // Target Device: // Tool vers...
#include <bits/stdc++.h> using namespace std; int main() { int a[11][11] = {0}, n; cin >> n; for (int i = 0; i < n; i++) { a[0][i] = 1; a[i][0] = 1; } for (int i = 1; i < n; i++) { for (int j = 1; j < n; j++) { a[i][j] = a[i - 1][j] + a[i][j - 1]; } } cout...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 29.11.2016 16:55:54 // Design Name: // Module Name: frequency_analyzer_testbench // Project Name: // Target Devices: // Tool Versions: // Description: // // Depend...
#include <bits/stdc++.h> using namespace std; vector<long long> adj[200005]; vector<long long> vis(200005); signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long i, j, k = 0, n, t = 1, m, l = 0; for (i = 0; i < 200005; i++) vis[i] = 0; while (t--) { ...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 20; vector<int> a[N]; vector<int> Q; int t, x, p, k; int solve(int n, int p) { int ret = 0; Q.clear(); Q.push_back(-1); vector<int>& f = a[p]; for (int i = 0; i < (int)f.size(); ++i) { int top = Q.size(); for (...
#include <bits/stdc++.h> using namespace std; bool prime(int x) { if (x == 1) return false; else if (x == 2) return true; for (int i = 2; i * i <= x; i++) { if (x % i == 0) return false; } return true; } void fun2(int t) { if (t == 1) { cout << * ; return; ...
#include <bits/stdc++.h> using namespace std; using ll = long long; const int inf = 1e9 + 7; const ll longinf = 1LL << 60; const ll mod = 1e9 + 7; int main() { ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; for (int i = 0; i < t; ++i) { int n; cin >> n; cout ...
//================================================================================================== // Filename : testbench_CORDICArch2.v // Created On : 2016-10-03 23:33:09 // Last Modified : 2016-10-03 23:33:26 // Revision : // Author : Jorge Sequeira Rojas // Company : Instituto Tecn...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: Adam LLC // Engineer: Adam Michael // // Create Date: 14:29:09 09/24/2015 // Design Name: KeyScanController // Module Name: C:/Users/adam/Documents/GitHub/Digital Systems/Lab2-Part2-Controller7Segmen...
/** * 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 gcd(long long a, long long b) { while (b) { a %= b; swap(a, b); } return a; } int main() { int n; cin >> n; vector<int> q(n); for (int i = 0; i < n; ++i) cin >> q[i]; vector<int> cost(n, -1); int m; cin >...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int A, B; cin >> A >> B; string a, b; cin >> a >> b; int p = 0, m = a.size(); for (int i = 0; i + a.size() <= b.size(); i++) { int k = 0; for (int j = 0; j < a.size(); j++) { if (a[j] != b[...
#include <bits/stdc++.h> using namespace std; inline long long read() { long long x = 0; char ch = getchar(); bool f = 0; for (; !isdigit(ch); ch = getchar()) if (ch == - ) f = 1; for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - 0 ; return f ? -x : x; } void write(long long ...
//wishbone_interconnect.v /* Distributed under the MIT licesnse. 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...
/** * 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> using namespace std; int N, M; long long Ans; struct rec { int w, h, s, k; rec() {} rec(int a, int b, int c, int i) { w = a; h = b; s = c; k = i; } } P[1010], Q[1010]; int vis[1010]; bool cmp_h(const rec &a, const rec &b) { return a.h > b.h;...
// part of NeoGS project (c) 2007-2008 NedoPC // // sound_mulacc is a serial multiplier-accumulator for volume and sound data value. // Input data is: volume (6bit unsigned) and sound data (8bit signed with sign bit inverted, // thus compatible with unsigned data centered at $7f-$80), and clr_sum bit. // Input da...
#include <bits/stdc++.h> using namespace std; long long BigMod(long long B, long long P, long long M) { long long R = 1; while (P > 0) { if (P % 2 == 1) { R = (R * B) % M; } P /= 2; B = (B * B) % M; } return R; } template <class T1> void deb(T1 e1) { cout <<...
#include <bits/stdc++.h> using namespace std; int s[100010]; int main() { long long n, x; cin >> n >> x; long long sum = 0, ans = 0; for (int i = 0; i < n; i++) { cin >> s[i]; } sort(s, s + n); int j = 0; while (j < n) { if (x < 1) x = 1; ans += s[j] * x; x-...
#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; signed main() { cin.tie(nullptr)->sync_with_stdio(false); long long n...
/* * 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...
//----------------------------------------------------------------------------- // The way that we connect things in low-frequency simulation mode. In this // case just pass everything through to the ARM, which can bit-bang this // (because it is so slow). // // Jonathan Westhues, April 2006 //-------------------------...
#include <bits/stdc++.h> template <class T> const T& min(const T& a, const T& b, const T& c) { return min(a, min(b, c)); } template <class T> const T& max(const T& a, const T& b, const T& c) { return max(a, max(b, c)); } using namespace std; int gcd(long long a, long long b) { while (true) {...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n <= 4) cout << No solution << endl; else { double alpha = 2 * M_PI / n; cout << fixed << setprecision(6); double x = 0, y = 0; for (int i = 1; i <= n - 2; i++) { cout << x << ...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long LINF = 0x3f3f3f3f3f3f3f3fll; mt19937 rng((int)chrono::steady_clock::now().time_since_epoch().count()); struct kuhn { int n, m; vector<vector<int>> g; vector<int> vis, ma, mb; kuhn(int n_, int m_) : n(n_),...
#include <bits/stdc++.h> int n, m, p, r[605], c[605], f[605], g[605][605], a[605][605], b[605][605]; void tuopu() { int h = 0, t = 0; for (int i = 1; i <= n; i++) if (!r[i]) f[++t] = i, g[i][t] = 1; m = t; while (h < t) { int x = f[++h]; for (int i = 1; i <= n; i++) if (b[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 la...
//Copyright 2014 Zeno Futurista () // //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 to in ...
/******************************************************************************* * 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 ...
#include <bits/stdc++.h> #pragma GCC optimize(3) using namespace std; inline long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } inline long long lcm(long long a, long long b) { return a * b / gcd(a, b); } inline int qpow(int a, int n) { int ans = 1; while (n) { if (n & 1) ...