This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/**
* author: _Spongey, AKA: Mosaab
**/
#include <bits/stdc++.h>
using namespace std;
#define fr(IN, OUT) freopen(IN ,"r",stdin); freopen(OUT,"w",stdout);
#define IOS_BASE ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define mod 1000000007
#define omod 998244353
#define rall(x) x.rbegin(),x.rend()
#define all(x) x.begin(),x.end()
#define DIJK priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>>
#define pb push_back
#define ff first
#define ss second
#define maxe(v) max_element(all(v))
#define mine(v) min_element(all(v))
#define inarr(a, n) for(int i = 0; i < n; ++i) cin >> a[i];
#define f(i, a, b) for(int i = a; i < b; ++i)
#define fro(i, a, b) for(int i = a - 1; i >= b; --i)
#define min3(a, b, c) min(a, min(b, c))
#define min4(a, b, c, d) min(a, min(b, min(c, d)))
#define max3(a, b, c) max(a, max(b, c))
#define max4(a, b, c, d) max(a, max(b, max(c, d)))
#define max5(a, b, c, d, e) max(a, max(b, max(c, max(d, e))))
#define min5(a, b, c, d, e) min(a, min(b, min(c, min(d, e))))
#define yon(FLAG) cout << (FLAG? "YES": "NO")
#define yes cout<<"YES"
#define no cout<<"NO"
#define int long long
using ll = long long;
using lld = long double;
using vi = vector<int>;
using vii = vector<vi>;
using aiii = array<int, 3>;
using pii = pair<int, int>;
using vpi = vector<pii>;
using vpii = vector<vpi>;
using vll = vector<ll>;
using vvll = vector<vi>;
using alll = array<ll, 3>;
using pll = pair<ll, ll>;
using vpll = vector<pii>;
using vvpll = vector<vpi>;
const int M = (5e2) + 7;
const int N = (2e5) + 7;
const long long intf = 1e9;
const long long inf = 1e18;
const long long bnf = 1e13;
int dx[4] = { 1, -1, 0, 0 }, dy[4] = { 0, 0, -1 ,1 };
class dsu {
public:
vector<int> p;
int n;
dsu(int _n) : n(_n) {
p.resize(n);
iota(p.begin(), p.end(), 0);
}
inline int get(int x) {
return (x == p[x] ? x : (p[x] = get(p[x])));
}
inline bool unite(int x, int y) {
x = get(x);
y = get(y);
if (x != y) {
p[x] = y;
return true;
}
return false;
}
};
template<int MOD>
struct ModInt {
unsigned x;
ModInt() : x(0) { }
ModInt(signed sig) : x(sig) { }
ModInt(signed long long sig) : x(sig% MOD) { }
int get() const { return (int)x; }
ModInt pow(ll p) { ModInt res = 1, a = *this; while (p) { if (p & 1) res *= a; a *= a; p *= 2; } return res; }
ModInt& operator+=(ModInt that) { if ((x += that.x) >= MOD) x -= MOD; return *this; }
ModInt& operator-=(ModInt that) { if ((x += MOD - that.x) >= MOD) x -= MOD; return *this; }
ModInt& operator*=(ModInt that) { x = (unsigned long long)x * that.x % MOD; return *this; }
ModInt& operator/=(ModInt that) { return (*this) *= that.pow(MOD - 2); }
ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }
bool operator<(ModInt that) const { return x < that.x; }
friend ostream& operator<<(ostream& os, ModInt a) { os << a.x; return os; }
};
typedef ModInt<998244353> mll; int fact[1000007];
mll c(ll a, ll b) {
mll s = fact[a], f = fact[b], g = fact[a - b];
return mll(s) / mll(f * g);
}
int ncr(int n, int r) {
r = min(r, n - r);
if (r < 0) return 0;
int a = fact[n] % omod;
int b = (fact[r] * fact[n - r]) % omod;
if (b == 0) return 0;
return ((a / b) % omod);
}
struct SegmentTree {
int size;
bool initialized = false;
vi nums;
void init(int n) {
size = 1;
while (size < n) size <<= 1;
nums.assign(4 * size, 0);
initialized = true;
}
void init(int n, vector<int>& array) {
if (!initialized) {
size = 1;
while (size < n) size <<= 1;
nums.assign(4 * size, 0);
}
for (int i = 0; i < n; ++i) set(i, array[i]);
}
void set(int i, int v) {
i += size;
nums[i] = v;
for (int j = i / 2; i > 0; i /= 2) nums[i] = nums[i * 2] + nums[i * 2 + 1];
}
int getSum(int l, int r) {
return getSum(l, r, 0, 0, size);
}
int getSum(int l, int r, int cur, int nl, int nr) {
if (r <= nl || l >= nr) return 0;
if (r >= nr && l <= nl) return nums[cur];
int mid = (nl + nr) / 2;
return getSum(l, r, cur * 2, nl, mid) + getSum(l, r, cur * 2 + 1, mid, nr);
}
};
void solve() {
int n, k; cin >> n >> k;
vi a(n + k); f(i, 0, n + k) cin >> a[i];
f(i, 0, n) cout << a[i] << ' ';
}
signed main() {
fact[0] = 1;
for (int i = 1; i <= 1e6; ++i) { fact[i] = fact[i - 1] * i; }
IOS_BASE
int T = 1;
//fr("sabotage.in", "sabotage.out")
cin >> T;
while (T--) {
solve();
cout << endl;
}
return 0;
}
Compilation message (stderr)
tabletennis.cpp: In member function 'void SegmentTree::set(long long int, long long int)':
tabletennis.cpp:147:18: warning: unused variable 'j' [-Wunused-variable]
147 | for (int j = i / 2; i > 0; i /= 2) nums[i] = nums[i * 2] + nums[i * 2 + 1];
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |