text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; const int c = 100005; void solve() { string s; cin >> s; long long o = 0, e = 0, m = 0; long long ans = INT_MAX; long long om = 5, em = 5; for (long long i = 0; i < s.size(); ++i) { if (i & 1) { if (s[i] == ? or s[i] == 1 ) o +...
#include <bits/stdc++.h> using namespace std; int a[100005]; int main() { int n, x; cin >> n >> x; long int sum = 0, zz; for (int i = 0; i < n; i++) cin >> zz, sum += zz; if (sum + n - 1 == x) cout << YES n ; else cout << NO n ; 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 la...
// usb_tx_fifo.v `timescale 1 ns / 1 ps module usb_tx_fifo ( input reset, input wrclk, input write, input [15:0]din, input [1:0]min, output full, input rdclk, input read, output [15:0]dout, output [1:0]mout, output empty ); wire [17:0]data = { min, din }; wire [17:0]q; assign {mout, dout} = q; dc...
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ps/1ps `default_nettype none module RAMB16_S1_S9 ( CLKA, CLKB, ENB, WEA, WEB,...
#include <bits/stdc++.h> using namespace std; template <typename T> struct Point { T x, y; Point() {} Point(T x_, T y_) : x(x_), y(y_) {} using pair = std::pair<T, T>; explicit operator pair() const { return pair(x, y); } friend bool operator==(const Point& a, const Point& b) { retur...
/*============================================================================ This Verilog source file is part of the Berkeley HardFloat IEEE Floating-Point Arithmetic Package, Release 1, by John R. Hauser. Copyright 2019 The Regents of the University of California. All rights reserved. Redistribution an...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-9; double ans = 0; map<double, double> F; void insert(double dist, double s) { double need = dist / (s + 1); F[s] += need; if (s > 1) F[s] += dist / (s - 1); ans += need; while (need > 1e-9) { map<double, double>::it...
// megafunction wizard: %ROM: 1-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: memory.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // =====================...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2013 by Ed Lander. // verilator lint_off WIDTH `define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", `__FILE__,`__LINE__, (gotv), ...
#include <bits/stdc++.h> using namespace std; struct chess { bool used; int x, y; char p; } up, down, Left, Right, up_Left, up_Right, down_Left, down_Right; int n, kx, ky; void add(int x, int y, char c) { if (x == kx) { if (y < ky) { if (!Left.used || y > Left.y) { Left...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, n; cin >> a >> b >> c >> n; int d = n - (a + b - c); if ((a - c) >= 0 && (b - c) >= 0 && c >= 0 && d > 0) { cout << d << endl; } else cout << -1 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int N, B, Q; int a[200005]; vector<int> adj[200005]; void init() { B = sqrt(N); for (int i = 1; i <= N; i++) { a[i] = i; adj[i / B].push_back(i); } } long long work(int l, int r) { if (l == r) return 0; int idx, idy, x, y, k; ...
#include <bits/stdc++.h> using namespace std; const int N = 500005; int a[N]; int main() { int n; while (scanf( %d , &n) != EOF) { memset(a, 0, sizeof(a)); for (int i = 0; i < n; i++) { scanf( %d , &a[i]); } sort(a, a + n); int mid = (n - 1) / 2; int big = n -...
#include <bits/stdc++.h> using namespace std; const int maxn = 1 << 16; map<pair<int, int>, int> dp[maxn]; int n, c[20], r[20], b[20], ed, rrr, bbb, ans = 0x3f3f3f3f; int main() { cin >> n; getchar(); for (int i = 1; i <= n; i++) { char ch; cin >> ch >> r[i] >> b[i]; if (ch == R...
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2014.2 (win64) Build 932637 Wed Jun 11 13:33:10 MDT 2014 // Date : Mon Dec 01 03:09:56 2014 // Host : ECE-411-6 running 64-bit Service Pack...
/* * 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 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Mon Feb 13 23:24:41 2017 // Host : TheMosass-PC running 64-bit major release ...
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; struct Matrix { long long a, b, c, d; Matrix(long long _a = 0, long long _b = 0, long long _c = 0, long long _d = 0) { a = _a; b = _b; c = _c; d = _d; } void normalize(Matrix& mat) { ...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; long long m = 0, cost = 0; ; int a, b; priority_queue<pair<int, int> > q; for (int i = 0; i < s.size(); i++) { m--; if (s[i] == ( ) m += 2; if (s[i] == ? ) { s[i] = ) ; cin...
//***************************************************************************** // (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 (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ps/1ps `default_nettype none module seq_rec #( parameter BASEADDR = 0, 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...
/* * 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...
// Texas A&M University // // cpsc350 Computer Architecture // //Alan Achtenberg?? //Project 2// `define OPCODE_ADD 6'b000000 `define OPCODE_SUB 6'b000000 `define OPCODE_ADDU 6'b000000 `define OPCODE_SUBU 6'b000000 `define OPCODE_AND 6'b000000 `define OPCODE_OR 6'b000000 `define OPCODE...
#include <bits/stdc++.h> constexpr unsigned primes[]{2672090437, 2569161337, 2414657393}; constexpr int np = sizeof(primes) / sizeof(*primes); std::vector<std::array<unsigned, np> > pow2; void setpow2(int maxp) { pow2.resize(maxp + 1); for (int i = 0; i < np; i++) pow2[0][i] = 1; for (int i = 1; i <...
#include <bits/stdc++.h> using namespace std; long long n, T, a, b, c; int x[4], y[4]; long long cost[4]; string ans; long long f(long long x, long long y) { return (x + y) * (abs(y - x) + 1) / 2; } long long Cal(int X, int Y, int x, int y) { if (X <= x && Y <= y) return f(0, x + y - X - Y) + f(0, n +...
#include <bits/stdc++.h> using namespace std; int i, j, n, c, d; string a[105], b[105]; int main() { for (cin >> n; i++ < n; d += !c) for (cin >> a[i] >> b[i], j = c = 0; ++j < i;) c += a[i] == a[j] & b[i] == b[j]; cout << d; return 0; }
/* Copyright (C) {2014} {Shawn Jain} <> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the ho...
#include <bits/stdc++.h> const int N = 1010; int sit[N], a[N]; int n, m, c; void ask(int x, int pos) { printf( %d n , pos); a[pos] = x; fflush(stdout); bool flag = true; for (int i = 1; i <= n; ++i) { if (!a[i]) { flag = false; break; } } for (int i = 1; i...
#include <bits/stdc++.h> #pragma GCC optimize( -O3 ) using namespace std; void solve() { long long int n, k; cin >> n >> k; vector<long long int> a(n); for (long long int i = 0; i < n; i++) cin >> a[i]; sort(a.begin(), a.end()); long long int ones = 0; vector<long long int> b; for ...
#include <bits/stdc++.h> using namespace std; int n, m, s, k, x, y, z, i, j, ans = 0; int a[2001][2], b[2001][2]; int main() { memset(a, 192, sizeof a); memset(b, 63, sizeof b); cin >> n >> m >> k >> s; for (i = 1; i <= n; i++) for (j = 1; j <= m; j++) { cin >> x; a[x][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...
// (C) 1992-2014 Altera Corporation. All rights reserved. // Your use of Altera Corporation's design tools, logic functions and other // software and tools, and its AMPP partner logic functions, and any output // files any of the foregoing (including device programming or simulati...
/* * Verilog side Virtual Processor, for running host * programs as control in simulation. * * Copyright (c) 2004-2016 Simon Southwell. * * This file is part of VProc. * * VProc is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published ...
#include <bits/stdc++.h> const int MAXN = 2e5 + 10; using namespace std; int T, N, cmp; int p[MAXN], c[MAXN]; vector<int> comp[MAXN]; bool vis[MAXN]; void dfs(int x) { vis[x] = true; comp[cmp].push_back(c[x]); if (!vis[p[x]]) dfs(p[x]); } int min_ans(int idx_comp) { int n_comp = (int)(...
#include <bits/stdc++.h> using namespace std; const long long int MOD = 1000000007; const long long BIG = 1446803456761533460LL; const int Big = 336860180; const long long int INF = LONG_LONG_MAX; const long long int adj4[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}; const long long int adj8[8][2] = {{0, 1}...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int arr[m + 1]; arr[0] = 1; for (int i = 1; i <= m; i++) cin >> arr[i]; long long step = 0; for (int i = 0; i < m; i++) { if (arr[i + 1] < arr[i]) step += (n - arr[i]) + (arr[i + 1] - 1) + 1...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
// Copyright (c) 2016 CERN // @author 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) // ...
#include <bits/stdc++.h> using namespace std; vector<unordered_set<long long>> v1(2e5), v2(2e5); void solve() { long long n, m; cin >> n >> m; for (auto i = 0; i < m; i++) { long long a, b; cin >> a >> b; a--; b--; v1[min(a, b)].insert(max(a, b)); } v2 = v1; l...
#include <bits/stdc++.h> using namespace std; int n, q, k; vector<int> v[1000010]; int lastans = 0, res[1000010]; void dfs(int np, int fath, int val) { res[np] = val; for (auto &x : v[np]) { if (x == fath) continue; dfs(x, np, min(val, x)); } } int main() { scanf( %d%d , &n, &q...
// DESCRIPTION: Verilator: Verilog Test module // // Copyright 2011 by Wilson Snyder. This program is free software; you can // redistribute it and/or modify it under the terms of either the GNU // Lesser General Public License Version 3 or the Perl Artistic License // Version 2.0. // SPDX-License-Identifier: LGPL-3.0-...
// Accellera Standard V2.5 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2010. All rights reserved. // local paramaters used as defines parameter TIME_START = 1'b0; parameter TIME_CHECK = 1'b1; reg [31:0] i; reg r_state; `ifdef OVL_XCHECK_OFF //Do nothing `else `ifdef OVL_IMPLICIT_XC...
#include <bits/stdc++.h> using namespace std; const int inf = 1e5 + 5; int n; int ans[inf]; int last[inf]; struct node { int x, h, q; bool operator<(const node &s) const { return s.x > x; } } a[inf << 1]; inline int read() { int a = 0; int b = 1; char c = getchar(); while (c < 0...
#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 T1, typename T2> inline bool umx(T1& a, T2 b) { if (a < b) { a = b; return 1; ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5; bool isprime[32000]; vector<int> prime; int a[maxn + 50], num[maxn + 50], factor[maxn + 50], now[maxn + 50]; int k, n, len = 0; long long ans = 0; bool check() { for (int i = 1; i <= len; ++i) if (now[i] < num[i]) return false...
/* Copyright (c) 2015-2017 Alex Forencich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distri...
#include <bits/stdc++.h> #pragma GCC_OPTIMIZE( ofast ) using namespace std; void solve() { long long n, k; cin >> n >> k; string s; cin >> s; string need; for (long long i = 0; i < k - 1; i++) { need.push_back( ( ); need.push_back( ) ); } for (long long i = 0; i < n / 2...
// $Id: c_binary_op.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 ...
/** * 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; const static int inf = 10000000; const static int mod = 1000000007; int check(const vector<string>& s, const vector<string>& t) { int n = s.size(); vector<int> idx(n); for (int i = 0; i < (int)(n); i++) { idx[i] = i; } int ret = 0; do {...
module trafficlight_controller (input wire clk, input wire rst, output reg light1_green, output reg light1_red, output reg light1_yellow, output reg light2...
#include <bits/stdc++.h> using namespace std; int n; string s; int dp[111][55][222][3]; int res; void dfs(int pos, int left, int x, int dx) { if (dp[pos][left][x + 100][dx + 1]) return; dp[pos][left][x + 100][dx + 1] = 1; if (pos == s.size()) { if (left == 0) res = max(res, abs(x)); ...
module InstMod ( ins, outs ); output [INWIDTH-1:0] ins; output [OUTWIDTH-1:0] outs; endmodule module test_top; /*AUTOWIRE*/ // Beginning of automatic wires (for undeclared instantiated-module outputs) wire [n*INWIDTH +: INWIDTH] ins; // From instName of InstMod.v wire [n*INWIDTH +: INWIDTH] ...
/* ########################################################################### # **EMMU** # # This block uses the upper 12 bits [31:20] of a memory address as an index # to read an entry from a table. # # The table is written from the mi_* configuration interface. # # The table can be configured as 12 bits wi...
#include <bits/stdc++.h> using namespace std; const long long N = 1e5; long long n, m; map<long long, long long> mp; long long ans[N], top; signed main() { cin >> n >> m; for (long long i = 1; i <= n; ++i) { long long x; cin >> x; mp[x] = 1; } for (long long i = 1; 26 > 30 ...
#include <bits/stdc++.h> using namespace std; int N, M; long double DP[1010][1010]; int i, j; int total, X; int main() { cin >> N >> M; DP[0][0] = 1.0; for (int i = 1; i <= N; i++) for (int j = 0; j <= M && j <= N; j++) { total = N * M - (i - 1); X = M - j; DP[i][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...
/** * 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 n; cin >> n; string s; cin >> s; char m = b ; int ans = 0; int k = 0, bm = 0, rm = 0; while (k < n) { if (s[k] == m) { if (m == b ) m = r ; else m = b ; k++; } e...
//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; using Int = long long; template <typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; } template <typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; } struct FastIO { FastIO() { cin.tie(0)...
#include <bits/stdc++.h> int main() { int n; scanf( %d , &n); int ara[n]; int temp, j; int i = 0; while (i < n) { scanf( %d , &ara[i]); i++; } i = 0; while (i < (n - 1)) { j = 0; while (j < (n - 1)) { if (ara[j] > ara[j + 1]) { temp = ara[j...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of inst_eg_e // // Generated // by: wig // on: Mon Mar 22 13:27:59 2004 // cmd: H:\work\mix_new\mix\mix_0.pl -strip -nodelta ../../mde_tests.xls // // !!! Do not edit this file! Autogenerated by MIX !!...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 10; char s1[N], s2[N], s[N]; int n, lst, nod, len[N], fail[N], diff[N], anc[N], ch[N][26]; int f[N], pos[N], pre[N]; void init() { fail[0] = fail[1] = nod = 1; len[1] = -1; } void extend(int c, int i) { int p = lst; while ...
/** * 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 GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) using namespace std; using ll = long long; template <class t, class u> bool chmax(t& first, u second) { if (first < second) { first = second; return true; } else return false; } template...
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you ...
#include <bits/stdc++.h> const int maxn = 5e5 + 5; using namespace std; bool vis[maxn]; int a[maxn]; int main() { string s; cin >> s; int k = s.size(); char y = s[0]; int ans = 1; for (int i = 0; i < k; i++) { if (i == 0) { cout << Mike << endl; continue; ...
#include <bits/stdc++.h> using namespace std; long long Mul(long long a, long long b) { long long res = 1; while (b) { if (b & 1) res = res * a % 1000000007; a = a * a % 1000000007; b >>= 1; } return res; } int A[200005]; long long F[200005], NF[200005], sum[200005], Two[2000...
(************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) (* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2016 *) (* \VV/ **************************************************************) (* // * Th...
#include <bits/stdc++.h> int main() { int n, l, v1, v2, k; while (~scanf( %d%d%d%d%d , &n, &l, &v1, &v2, &k)) { if (k >= n) { printf( %.10lf n , l * 1.0 / v2); continue; } int t = (n - 1) / k; double s = v2 * 1.0 / v1; double kk = (1 + s) / (3 + s); double t...
#include <bits/stdc++.h> using namespace std; int a, b, c; const long long MOD = 1073741824; map<int, int> divisors; int make_divisors(int n) { if (divisors[n] != 0) return divisors[n]; int cnt = 0; int lim = n + 1; for (int i = 1; i < lim; i++) { if (n == n / i * i) { if (i * i ...
#include <bits/stdc++.h> using namespace std; const long long losn = 1e6 + 5; const long long maxn = 1e5 + 5; const long long minn = 1e3 + 5; const long long tiny = 1e2 + 5; const long long inf = 1e9; const long long mod = 1e9 + 7; const long long hmod = 4698571; long long n; char c[maxn * 2]; map...
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { if (0) return; cout << name << : << arg1 << n ; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { if (0) return; const ...
#include <bits/stdc++.h> using namespace std; int mod = 1e9 + 7; bool prime[1000001] = {true}; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m; cin >> n >> m; vector<int> arr(m); if (m == 0) { cout << YES ; return 0; } for (int i = 0; i < m; i+...
`timescale 1ns / 100ps `include "parameter.v" module ecg_signal_max(thr1,thr2,count1,count2,min_pos_l3, max_pos_l3,data_in,clk,nReset); output [15:0] thr1,thr2; reg signed [15:0] ecg_max,ecg_min,thr1,thr2; input signed [15:0] data_in; input [15:0] min_pos_l3,max_pos_l3; input [3:0] count1; input [8:0] count2; i...
#include <bits/stdc++.h> using namespace std; int dp[1003][1003], a[1003]; pair<pair<int, int>, int> from[1003][1003]; vector<pair<int, int> > sol; int main() { int N; cin >> N; for (int i = 1; i <= N; i++) cin >> a[i]; if (N % 2 == 0) { N++; a[N] = 0; } memset(dp, 0x3f3f3f...
#include <bits/stdc++.h> using namespace std; int main() { int n, performance; long long cost = 0; long long k; cin >> n >> k; int x[n], c[n]; for (int& e : x) cin >> e; cin >> performance; for (int& e : c) cin >> e; priority_queue<int, vector<int>, greater<int>> rem; int i =...
#include <bits/stdc++.h> using namespace std; int n, a[51][51], ans[51]; bool check(int j, int x) { for (int i = 1; i <= n; i++) if (a[j][i] > x || a[i][j] > x) return false; ans[j] = x; return true; } int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) for (int j = 1; 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...
/* * 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...
////////////////////////////////////////////////////////////////////////////////// // Company: LKB // Engineer: Leonhard Neuhaus // // Create Date: 12.08.2015 17:40:42 // Design Name: // Module Name: i_adv_trigger // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // R...
/** * 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 a, b, c, d, e, f; scanf( %d%d%d%d%d%d , &a, &b, &c, &d, &e, &f); if (d == 0) { printf( Hermione ); return 0; } if (c == 0) { printf( Ron ); return 0; } if (b == 0) { printf( Hermione ); ret...
#include <bits/stdc++.h> using namespace std; int n, i, b, a[105]; int main() { cin >> n; for (i = 1; i <= n; i++) { cin >> a[i]; b += a[i]; } if (b != 0) { cout << YES n1 n1 << n; return 0; } for (i = 1; i <= n; i++) { if (a[i] != 0) { break; ...
`default_nettype none module prioenc #( parameter REQ_LEN = 4, parameter GRANT_LEN = 2 ) ( input wire [REQ_LEN-1:0] in, output reg [GRANT_LEN-1:0] out, output reg en ); integer i; always @ (*) begin en = 0; out = 0; for (i = REQ_LEN-1 ; i >= 0 ; ...
#include <bits/stdc++.h> using namespace std; int v, s, vs, sv; void printAns() { cout << vier: << v << sieben: << s << vs: << vs << sv: << sv << endl; } int main() { cin >> v >> s >> vs >> sv; string ans = ; bool flag = true; if (v < vs || s < vs || v < sv || v <...
`include "../rtl/ram_sp.v" `default_nettype none `timescale 1ms/1us module tb_ram_sp; parameter DWIDTH = 8; parameter AWIDTH = 12; parameter CONTENT = "./memory.txt"; reg clock; reg wren; reg [AWIDTH-1:0] address; reg [DWIDTH-1:0] data; wire [DWIDTH-1:0] q; ram_sp #( .DWIDTH ( 8 ...
//**************************************************************************************************** //*---------------Copyright (c) 2016 C-L-G.FPGA1988.lichangbeiju. All rights reserved----------------- // // -- It to be define -- // -- ...
/******************************************************************************* * 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 long long mod = 1e9 + 7; const double pi = acos(-1); long long n; string str; int main() { cin >> n >> str; sort(str.begin(), str.end()); cout << str << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, i, j, n, mx, p, b[1001], m; cin >> n >> m; for (i = 1; i <= 1000; i++) b[i] = 0; for (i = 1; i <= m; i++) { mx = -1; p = -1; for (j = 1; j <= n; j++) { cin >> a; if (a > mx) { mx = a; ...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: ctu_top_rptr.v // Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. // // The above named program is free software; you can redistribute it and/...
#include <bits/stdc++.h> using namespace std; int a, b; int sum; int main() { cin >> a >> b; while (a >= b) { sum += a / b * b; a = a / b + a % b; } cout << sum + a; return 0; }
#include <bits/stdc++.h> using namespace std; int z[26][200001], w[26]; int main() { int n, m, i, j, a, le; char str[200001]; scanf( %d %d , &n, &m); scanf( %s , str); for (i = 0; str[i]; i++) { z[str[i] - a ][w[str[i] - a ]] = i; w[str[i] - a ]++; } long long ans; i...
//----------------------------------------------------------------------------- // // (c) Copyright 2009-2011 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...