제출 #1135084

#제출 시각아이디문제언어결과실행 시간메모리
1135084brianhdzmdo디지털 회로 (IOI22_circuit)C++20
0 / 100
3058 ms4976 KiB
#include <bits/stdc++.h> #define all(a) (a).begin(), (a).end() #define allr(a) (a).rbegin(), (a).rend() #define ll long long #define lli long long int #define fr(i, a, b) for (ll i = a; i < b; i++) #define fr1(i, a, b) for (ll i = a - 1; i >= b; i--) #define fi first #define se second #define mp(j, k) make_pair(j, k) #define pb(x) push_back(x) #define pbp(x, y) push_back({x, y}) #define in(x) insert(x) #define vec vector<ll> #define vecb vector<bool> #define vecp vector<pair<ll, ll>> #define vecv vector<vector<ll>> #define yes cout << "YES\n"; #define no cout << "NO\n"; #define ac 1e-7 #define fauto(a) \ for (auto i : a) \ cout << i << " "; #define fautop(a) \ for (auto i : a) \ cout << i.fi << " " << i.se << endl; using namespace std; const int MOD = 1000002022; ll N, M; vector<int> P; vector<int> A; vecv ins; vec umb; vec est; void init(int n, int m, vector<int> p, vector<int> a) { N = n; M = m; A = a; P = p; ins.assign(N + M, vec()); umb.assign(N, 0); est.assign(N + M, 0); fr(i, 1, N + M) ins[P[i]].pb(i); fr(i, 0, M) est[N + i] = A[i]; } int count_ways(int L, int R) { fr(i, L, R + 1) est[i] = 1 - est[i]; vec ans(N + M, 0); fr1(i, (N + M), 0) { if(i >= N) { ans[i] = est[i]; } else { ll umbr = umb[i]; ll acti = 0; for(ll e : ins[i]) { acti += (ans[e] > 0); } if(acti >= umbr) ans[i] = 1; } } return ans[0] % MOD; }
#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...