# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
733666 | 2023-05-01T07:27:40 Z | tigar | 슈퍼트리 잇기 (IOI20_supertrees) | C++14 | 1000 ms | 1252896 KB |
#include <bits/stdc++.h> #include "supertrees.h" using namespace std; typedef long long ll; vector<int> jedan[1010], dva[1010]; bool check[1010]; vector<int>lin; vector<int>cc[1010]; bool provera(int x, std::vector<std::vector<int>>p, int cmp) { lin.push_back(x); cc[cmp].push_back(x); int n=p.size(); for(int i=0; i<jedan[x].size(); i++) { if(check[jedan[x][i]])continue; check[jedan[x][i]]=true; for(int j=0; j<n; j++) { if(p[jedan[x][i]][j]!=p[x][j])return false; } } for(int i=0; i<dva[x].size(); i++) { if(check[dva[x][i]])continue; check[dva[x][i]]=true; for(int j=0; j<n; j++) { if(p[dva[x][i]][j]!=0 and p[x][j]==0)return false; if(p[dva[x][i]][j]==0 and p[x][j]!=0)return false; } if(!provera(dva[x][i], p, cmp))return false; } return true; } int construct(std::vector<std::vector<int>>p) { int n=p.size(); for(int i=0; i<n; i++) { for(int j=0; j<n; j++) { if(p[i][j]==1)jedan[i].push_back(j); else if(p[i][j]==2)dva[i].push_back(j); else if(p[i][j]==3)return 0; } } int br=1; for(int i=0; i<n; i++) { if(check[i])continue; if(!provera(i, p, br))return 0; br++; } vector<vector<int> > ans(n); for(int i=0; i<n; i++){ans[i].resize(n, 0);} for(int i=0; i<lin.size(); i++) { for(int j=1; j<jedan[lin[i]].size(); j++) { ans[jedan[lin[i]][j]][jedan[lin[i]][j-1]]=1; ans[jedan[lin[i]][j-1]][jedan[lin[i]][j]]=1; } } for(int i=1; i<br; i++) { for(int j=0; j<cc[i].size(); j++) { //cout<<cc[i][j]<<" "; if(cc[i].size()==2)return 0; ans[cc[i][j]][cc[i][j+1%cc[i].size()]]=1; ans[cc[i][j+1%cc[i].size()]][cc[i][j]]=1; } //cout<<endl; } for(int i=0; i<n; i++) { ans[i][i]=0; } //for(int i=0; i<n; i++){for(int j=0; j<n; j++)cout<<ans[i][j]<<" "; cout<<endl;} build(ans); return 1; } /*int main() { int n; cin>>n; vector<vector<int> >p; for(int i=0; i<n; i++) { vector<int>pp(n); for(int j=0; j<n; j++) { cin>>pp[j]; } p.push_back(pp); } cout<<construct(p); }*/
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
4 | Correct | 0 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 8 ms | 1468 KB | Output is correct |
7 | Correct | 164 ms | 26072 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
4 | Correct | 0 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 8 ms | 1468 KB | Output is correct |
7 | Correct | 164 ms | 26072 KB | Output is correct |
8 | Correct | 0 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 11 ms | 1328 KB | Output is correct |
13 | Correct | 705 ms | 22640 KB | Output is correct |
14 | Correct | 0 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 4 ms | 980 KB | Output is correct |
17 | Correct | 83 ms | 15208 KB | Output is correct |
18 | Correct | 1 ms | 372 KB | Output is correct |
19 | Correct | 0 ms | 340 KB | Output is correct |
20 | Correct | 47 ms | 6248 KB | Output is correct |
21 | Correct | 178 ms | 23176 KB | Output is correct |
22 | Correct | 359 ms | 22592 KB | Output is correct |
23 | Correct | 182 ms | 24756 KB | Output is correct |
24 | Correct | 612 ms | 22792 KB | Output is correct |
25 | Correct | 81 ms | 13200 KB | Output is correct |
26 | Correct | 80 ms | 12776 KB | Output is correct |
27 | Correct | 189 ms | 25784 KB | Output is correct |
28 | Correct | 706 ms | 22632 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 14 ms | 1336 KB | Output is correct |
9 | Correct | 596 ms | 24072 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 23 ms | 33764 KB | Output is correct |
13 | Execution timed out | 1117 ms | 1252896 KB | Time limit exceeded |
14 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 372 KB | Output is correct |
3 | Correct | 1 ms | 372 KB | Output is correct |
4 | Correct | 50 ms | 6352 KB | Output is correct |
5 | Correct | 188 ms | 24592 KB | Output is correct |
6 | Correct | 362 ms | 24084 KB | Output is correct |
7 | Correct | 182 ms | 26068 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Incorrect | 160 ms | 30728 KB | Too many ways to get from 0 to 436, should be 0 found no less than 1 |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
4 | Correct | 0 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 8 ms | 1468 KB | Output is correct |
7 | Correct | 164 ms | 26072 KB | Output is correct |
8 | Correct | 0 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 11 ms | 1328 KB | Output is correct |
13 | Correct | 705 ms | 22640 KB | Output is correct |
14 | Correct | 0 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 4 ms | 980 KB | Output is correct |
17 | Correct | 83 ms | 15208 KB | Output is correct |
18 | Correct | 1 ms | 372 KB | Output is correct |
19 | Correct | 0 ms | 340 KB | Output is correct |
20 | Correct | 47 ms | 6248 KB | Output is correct |
21 | Correct | 178 ms | 23176 KB | Output is correct |
22 | Correct | 359 ms | 22592 KB | Output is correct |
23 | Correct | 182 ms | 24756 KB | Output is correct |
24 | Correct | 612 ms | 22792 KB | Output is correct |
25 | Correct | 81 ms | 13200 KB | Output is correct |
26 | Correct | 80 ms | 12776 KB | Output is correct |
27 | Correct | 189 ms | 25784 KB | Output is correct |
28 | Correct | 706 ms | 22632 KB | Output is correct |
29 | Correct | 1 ms | 340 KB | Output is correct |
30 | Correct | 1 ms | 340 KB | Output is correct |
31 | Correct | 1 ms | 340 KB | Output is correct |
32 | Correct | 1 ms | 340 KB | Output is correct |
33 | Correct | 1 ms | 340 KB | Output is correct |
34 | Correct | 1 ms | 340 KB | Output is correct |
35 | Correct | 1 ms | 340 KB | Output is correct |
36 | Correct | 14 ms | 1336 KB | Output is correct |
37 | Correct | 596 ms | 24072 KB | Output is correct |
38 | Correct | 1 ms | 340 KB | Output is correct |
39 | Correct | 1 ms | 340 KB | Output is correct |
40 | Correct | 23 ms | 33764 KB | Output is correct |
41 | Execution timed out | 1117 ms | 1252896 KB | Time limit exceeded |
42 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
4 | Correct | 0 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 8 ms | 1468 KB | Output is correct |
7 | Correct | 164 ms | 26072 KB | Output is correct |
8 | Correct | 0 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 11 ms | 1328 KB | Output is correct |
13 | Correct | 705 ms | 22640 KB | Output is correct |
14 | Correct | 0 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 4 ms | 980 KB | Output is correct |
17 | Correct | 83 ms | 15208 KB | Output is correct |
18 | Correct | 1 ms | 372 KB | Output is correct |
19 | Correct | 0 ms | 340 KB | Output is correct |
20 | Correct | 47 ms | 6248 KB | Output is correct |
21 | Correct | 178 ms | 23176 KB | Output is correct |
22 | Correct | 359 ms | 22592 KB | Output is correct |
23 | Correct | 182 ms | 24756 KB | Output is correct |
24 | Correct | 612 ms | 22792 KB | Output is correct |
25 | Correct | 81 ms | 13200 KB | Output is correct |
26 | Correct | 80 ms | 12776 KB | Output is correct |
27 | Correct | 189 ms | 25784 KB | Output is correct |
28 | Correct | 706 ms | 22632 KB | Output is correct |
29 | Correct | 1 ms | 340 KB | Output is correct |
30 | Correct | 1 ms | 340 KB | Output is correct |
31 | Correct | 1 ms | 340 KB | Output is correct |
32 | Correct | 1 ms | 340 KB | Output is correct |
33 | Correct | 1 ms | 340 KB | Output is correct |
34 | Correct | 1 ms | 340 KB | Output is correct |
35 | Correct | 1 ms | 340 KB | Output is correct |
36 | Correct | 14 ms | 1336 KB | Output is correct |
37 | Correct | 596 ms | 24072 KB | Output is correct |
38 | Correct | 1 ms | 340 KB | Output is correct |
39 | Correct | 1 ms | 340 KB | Output is correct |
40 | Correct | 23 ms | 33764 KB | Output is correct |
41 | Execution timed out | 1117 ms | 1252896 KB | Time limit exceeded |
42 | Halted | 0 ms | 0 KB | - |