답안 #447434

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
447434 2021-07-26T10:18:44 Z Nodir_Bobiev 슈퍼트리 잇기 (IOI20_supertrees) C++17
21 / 100
368 ms 24120 KB
#include "supertrees.h"
#include <bits/stdc++.h>
using namespace std ;

int construct(std::vector<std::vector<int>> p) {
      int n = p.size();
      vector <vector <int>> ans;
      for(int i = 0; i < n; i ++){
            vector <int> row;
            row.resize(n);
            ans.push_back(row);
      }
      map <int, long> us, comp;
      for(int i = 0; i < n; i ++){
            if( us[i] ) continue;
            comp[i] = i;
            for(int j = 0; j < n; j ++){
                if( p[i][j] ){
                    if( i == j ) continue;
                    if( us[j] ) return 0;
                    us[j] = 1, comp[j] = i;
                    ans[i][j] = ans[j][i] = 1;
                }
            }
      }
      for(int i = 0; i < n; i ++){
            for(int j = 0; j < n; j ++){
                if( ( comp[i] == comp[j] ) != p[i][j] ) return 0;
            }
      }
      build(ans);
      return 1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 12 ms 1100 KB Output is correct
7 Correct 299 ms 22280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 12 ms 1100 KB Output is correct
7 Correct 299 ms 22280 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 12 ms 1100 KB Output is correct
13 Correct 299 ms 22180 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 5 ms 716 KB Output is correct
17 Correct 102 ms 12100 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 74 ms 6252 KB Output is correct
21 Correct 288 ms 24004 KB Output is correct
22 Correct 368 ms 24120 KB Output is correct
23 Correct 321 ms 24060 KB Output is correct
24 Correct 289 ms 24004 KB Output is correct
25 Correct 142 ms 14204 KB Output is correct
26 Correct 96 ms 14148 KB Output is correct
27 Correct 336 ms 24048 KB Output is correct
28 Correct 290 ms 24060 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Incorrect 1 ms 204 KB Answer gives possible 0 while actual possible 1
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Answer gives possible 0 while actual possible 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 12 ms 1100 KB Output is correct
7 Correct 299 ms 22280 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 12 ms 1100 KB Output is correct
13 Correct 299 ms 22180 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 5 ms 716 KB Output is correct
17 Correct 102 ms 12100 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 74 ms 6252 KB Output is correct
21 Correct 288 ms 24004 KB Output is correct
22 Correct 368 ms 24120 KB Output is correct
23 Correct 321 ms 24060 KB Output is correct
24 Correct 289 ms 24004 KB Output is correct
25 Correct 142 ms 14204 KB Output is correct
26 Correct 96 ms 14148 KB Output is correct
27 Correct 336 ms 24048 KB Output is correct
28 Correct 290 ms 24060 KB Output is correct
29 Correct 0 ms 204 KB Output is correct
30 Correct 0 ms 204 KB Output is correct
31 Correct 0 ms 204 KB Output is correct
32 Correct 0 ms 204 KB Output is correct
33 Incorrect 1 ms 204 KB Answer gives possible 0 while actual possible 1
34 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 12 ms 1100 KB Output is correct
7 Correct 299 ms 22280 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 12 ms 1100 KB Output is correct
13 Correct 299 ms 22180 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 5 ms 716 KB Output is correct
17 Correct 102 ms 12100 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 74 ms 6252 KB Output is correct
21 Correct 288 ms 24004 KB Output is correct
22 Correct 368 ms 24120 KB Output is correct
23 Correct 321 ms 24060 KB Output is correct
24 Correct 289 ms 24004 KB Output is correct
25 Correct 142 ms 14204 KB Output is correct
26 Correct 96 ms 14148 KB Output is correct
27 Correct 336 ms 24048 KB Output is correct
28 Correct 290 ms 24060 KB Output is correct
29 Correct 0 ms 204 KB Output is correct
30 Correct 0 ms 204 KB Output is correct
31 Correct 0 ms 204 KB Output is correct
32 Correct 0 ms 204 KB Output is correct
33 Incorrect 1 ms 204 KB Answer gives possible 0 while actual possible 1
34 Halted 0 ms 0 KB -