# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
244695 | 2020-07-04T15:47:05 Z | TheLorax | Political Development (BOI17_politicaldevelopment) | C++11 | 397 ms | 524292 KB |
#include <bits/stdc++.h> //#pragma GCC optimize ("O3") //#pragma GCC optimize ("Ofast") #define F first #define S second #define MT make_tuple #define MP make_pair #define SZ(a) ((int)(a).size()) #define PB push_back #define LEFT(i) (2*(i)) #define RIGHT(i) (2*(i)+1) #define PAR(i) ((i)/2) #define ALL(a) (a).begin(), (a).end() #define END(s) {cout << s;return;} using namespace std; typedef long long ll; typedef pair<ll, ll> ii; int n; std::vector<std::vector<int> > e; void rek(int a, int f, int s){ for(auto x: e[a]){ if(x==s){ printf("3\n"); exit(0); } if(x==f) continue; rek(x, a, f); } } int main(){ int k; scanf("%d %d", &n, &k); e.resize(n); for(int i=0; i<n; i++){ int d; scanf("%d", &d); for(int j=0; j<d; j++){ int t; scanf("%d", &t); e[i].PB(t); } } //k<=3 for(int i=0; i<n; i++) rek(i, -1, -1); //k<=2 for(int i=0; i<n; i++) if(SZ(e[i])){ printf("2\n"); return 0; } //k<=1 printf("1\n"); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 256 KB | Output is correct |
3 | Correct | 397 ms | 640 KB | Output is correct |
4 | Correct | 136 ms | 640 KB | Output is correct |
5 | Correct | 128 ms | 768 KB | Output is correct |
6 | Correct | 143 ms | 640 KB | Output is correct |
7 | Correct | 139 ms | 640 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 4 ms | 128 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 256 KB | Output is correct |
3 | Correct | 397 ms | 640 KB | Output is correct |
4 | Correct | 136 ms | 640 KB | Output is correct |
5 | Correct | 128 ms | 768 KB | Output is correct |
6 | Correct | 143 ms | 640 KB | Output is correct |
7 | Correct | 139 ms | 640 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 4 ms | 128 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 119 ms | 640 KB | Output is correct |
12 | Correct | 119 ms | 760 KB | Output is correct |
13 | Runtime error | 331 ms | 524292 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
14 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Runtime error | 310 ms | 524292 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 256 KB | Output is correct |
3 | Correct | 397 ms | 640 KB | Output is correct |
4 | Correct | 136 ms | 640 KB | Output is correct |
5 | Correct | 128 ms | 768 KB | Output is correct |
6 | Correct | 143 ms | 640 KB | Output is correct |
7 | Correct | 139 ms | 640 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 4 ms | 128 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 119 ms | 640 KB | Output is correct |
12 | Correct | 119 ms | 760 KB | Output is correct |
13 | Runtime error | 331 ms | 524292 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
14 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 256 KB | Output is correct |
3 | Correct | 397 ms | 640 KB | Output is correct |
4 | Correct | 136 ms | 640 KB | Output is correct |
5 | Correct | 128 ms | 768 KB | Output is correct |
6 | Correct | 143 ms | 640 KB | Output is correct |
7 | Correct | 139 ms | 640 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 4 ms | 128 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 119 ms | 640 KB | Output is correct |
12 | Correct | 119 ms | 760 KB | Output is correct |
13 | Runtime error | 331 ms | 524292 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
14 | Halted | 0 ms | 0 KB | - |