Submission #629138

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6291382022-08-14 08:10:33kdh9949Digital Circuit (IOI22_circuit)C++17
100 / 100
1304 ms29456 KiB
#include "circuit.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int SZ = 131072;
const ll MOD = ll(1e9) + 2022;
struct Seg {
int l[2 * SZ];
ll d[2 * SZ], w[2 * SZ];
void i(int n, vector<int> a, vector<ll> v) {
for(int i = 0; i < n; i++) w[i + SZ] = v[i];
for(int i = 0; i < n; i++) if(a[i]) d[i + SZ] = v[i];
for(int i = SZ - 1; i; i--) {
d[i] = (d[2 * i] + d[2 * i + 1]) % MOD;
w[i] = (w[2 * i] + w[2 * i + 1]) % MOD;
}
}
void flp(int x) {
d[x] = (w[x] + MOD - d[x]) % MOD;
l[x] ^= 1;
}
void u(int s, int e, int x = 1, int p = 0, int q = SZ - 1) {
if(e < p || q < s) return;
if(s <= p && q <= e) {
flp(x);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...