# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
348782 | 2021-01-15T17:09:48 Z | Mefarnis | Regions (IOI09_regions) | C++14 | 88 ms | 27884 KB |
#include <bits/stdc++.h> #define fi first #define se second #define maxm 501 #define maxn 200001 #define pb push_back using namespace std; typedef long long LL; typedef pair<int,int> pi; int n,m,q; int dad[maxn]; int group[maxn]; int chain[maxm]; int res[maxm][maxm]; vector<int> adj[maxn]; void dfs(int u) { int deg = adj[u].size(); for( int i = 1 ; i <= m ; i++ ) res[i][group[u]] += chain[i]; chain[group[u]]++; for( int i = 0 ; i < deg ; i++ ) dfs(adj[u][i]); chain[group[u]]--; } int main() { scanf("%d%d%d",&n,&m,&q); scanf("%d",&group[1]); for( int i = 2 ; i <= n ; i++ ) { scanf("%d%d",&dad[i],&group[i]); adj[dad[i]].pb(i); } dfs(1); for( int i = 0 , x,y ; i < q ; i++ ) { scanf("%d%d",&x,&y); printf("%d\n",res[x][y]); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3 ms | 4972 KB | Time limit exceeded (wall clock) |
2 | Execution timed out | 3 ms | 4992 KB | Time limit exceeded (wall clock) |
3 | Execution timed out | 3 ms | 5100 KB | Time limit exceeded (wall clock) |
4 | Execution timed out | 4 ms | 5100 KB | Time limit exceeded (wall clock) |
5 | Execution timed out | 4 ms | 5100 KB | Time limit exceeded (wall clock) |
6 | Execution timed out | 4 ms | 5612 KB | Time limit exceeded (wall clock) |
7 | Execution timed out | 4 ms | 5356 KB | Time limit exceeded (wall clock) |
8 | Execution timed out | 5 ms | 5484 KB | Time limit exceeded (wall clock) |
9 | Execution timed out | 7 ms | 6124 KB | Time limit exceeded (wall clock) |
10 | Execution timed out | 14 ms | 6252 KB | Time limit exceeded (wall clock) |
11 | Execution timed out | 14 ms | 6144 KB | Time limit exceeded (wall clock) |
12 | Execution timed out | 23 ms | 7040 KB | Time limit exceeded (wall clock) |
13 | Execution timed out | 22 ms | 6252 KB | Time limit exceeded (wall clock) |
14 | Execution timed out | 23 ms | 6508 KB | Time limit exceeded (wall clock) |
15 | Execution timed out | 28 ms | 9580 KB | Time limit exceeded (wall clock) |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 45 ms | 9196 KB | Time limit exceeded (wall clock) |
2 | Execution timed out | 49 ms | 7788 KB | Time limit exceeded (wall clock) |
3 | Execution timed out | 60 ms | 11244 KB | Time limit exceeded (wall clock) |
4 | Runtime error | 26 ms | 17004 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
5 | Runtime error | 26 ms | 17772 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
6 | Runtime error | 30 ms | 18020 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
7 | Runtime error | 35 ms | 19052 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
8 | Runtime error | 43 ms | 21760 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
9 | Runtime error | 60 ms | 24172 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
10 | Runtime error | 67 ms | 25964 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
11 | Runtime error | 71 ms | 22572 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
12 | Runtime error | 74 ms | 27136 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
13 | Runtime error | 78 ms | 25964 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
14 | Runtime error | 74 ms | 25708 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
15 | Runtime error | 80 ms | 27884 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
16 | Runtime error | 77 ms | 27884 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
17 | Runtime error | 88 ms | 27756 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |