# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
102111 | 2019-03-22T11:50:35 Z | figter001 | Regions (IOI09_regions) | C++17 | 250 ms | 53572 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef unsigned long long ull; const int nax = 2e5 + 50; const int rax = 510; int r[nax],dp[rax][rax],ans[rax][rax]; int n,R,q; vector<int> g[nax]; void dfs(int u,int p){ for(int v : g[u]){ if(v == p) continue; dfs(v,u); dp[u][r[v]]++; } if(p != -1){ for(int i=1;i<=R;i++) dp[p][i] += dp[u][i]; } for(int i=1;i<=R;i++){ ans[r[u]][i] += dp[u][i]; } } int main(){ cin>>n>>R>>q; cin>>r[1]; for(int i=2;i<=n;i++){ int p; cin>>p>>r[i]; g[p].push_back(i); } dfs(1,0); int a,b; for(int i=0;i<q;i++){ scanf("%d%d",&a,&b); printf("%d\n", ans[a][b]); fflush(stdout); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 4992 KB | Output is correct |
2 | Correct | 8 ms | 5120 KB | Output is correct |
3 | Correct | 4 ms | 5248 KB | Output is correct |
4 | Correct | 13 ms | 5248 KB | Output is correct |
5 | Correct | 23 ms | 6144 KB | Output is correct |
6 | Incorrect | 27 ms | 7552 KB | Output isn't correct |
7 | Runtime error | 15 ms | 11648 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
8 | Runtime error | 18 ms | 12928 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
9 | Runtime error | 15 ms | 11008 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
10 | Runtime error | 21 ms | 11824 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
11 | Runtime error | 37 ms | 14628 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
12 | Runtime error | 44 ms | 11768 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
13 | Runtime error | 29 ms | 10908 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
14 | Runtime error | 37 ms | 13560 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
15 | Runtime error | 48 ms | 18956 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 102 ms | 14968 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Runtime error | 65 ms | 16120 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Runtime error | 107 ms | 18216 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
4 | Runtime error | 46 ms | 11512 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
5 | Runtime error | 41 ms | 12664 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
6 | Runtime error | 47 ms | 13048 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
7 | Runtime error | 81 ms | 14044 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
8 | Runtime error | 109 ms | 18168 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
9 | Runtime error | 162 ms | 19968 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
10 | Runtime error | 141 ms | 22076 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
11 | Runtime error | 212 ms | 18748 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
12 | Runtime error | 180 ms | 23024 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
13 | Runtime error | 231 ms | 22124 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
14 | Runtime error | 170 ms | 21780 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
15 | Runtime error | 250 ms | 26616 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
16 | Runtime error | 195 ms | 53572 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
17 | Runtime error | 165 ms | 24024 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |