# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
834707 | IBory | Digital Circuit (IOI22_circuit) | C++17 | 961 ms | 34952 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "circuit.h"
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll SZ = 1 << 18, MOD = 1'000'002'022;
vector<int> G[SZ];
ll N, M, S[SZ], A[SZ], ans;
ll DFS(int cur) {
ll& ret = S[cur] = G[cur].size();
if (G[cur].empty()) ret = 1;
for (int next : G[cur]) {
ll c = DFS(next);
ret = ret * c % MOD;
}
return ret;
}
void DFS2(int cur, ll n) {
if (G[cur].empty()) {
A[cur] = n;
return;
}
vector<ll> D;
for (int next : G[cur]) D.push_back(S[next]);
for (int i = (int)D.size() - 2; i >= 0; --i) D[i] = D[i] * D[i + 1] % MOD;
ll pref = 1;
for (int i = 0; i < G[cur].size(); ++i) {
ll t = n * pref % MOD;
Compilation message (stderr)
# | 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... |