답안 #902877

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
902877 2024-01-11T04:01:24 Z ByeWorld 슈퍼트리 잇기 (IOI20_supertrees) C++14
21 / 100
163 ms 24164 KB
#include "supertrees.h"
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define lb lower_bound
using namespace std;
const int MAXN = 1e3+10;
const double SMALL = 1e-6;
typedef pair<int,int> pii;
typedef pair<pii,int> ipii;

int n;
bool tag[MAXN], done[MAXN];
vector <vector<int>> adj;

void bd(int x, int y){
	adj[x][y] = 1; adj[y][x] = 1;
}

int construct(vector<vector<int>> p) {
	n = p.size();
	vector <int> te(n);
	for(int i=0; i<n; i++) adj.pb(te);

	for(int i = 0; i < n; i++) {
		if(done[i]) continue;
		for(int x=0; x<n; x++) tag[x] = 0;

		vector <int> vec; vec.pb(i); tag[i] = 1;
		for(int j=i+1; j < n; j++){
 
			if(p[i][j] == 1){
				vec.pb(j); tag[j] = 1;
			}	
		}
		//for(auto in : vec) cout << in << "pp\n";
		for(auto in : vec){
			//cout << in << " in\n";
			done[in] = 1;
			for(int x=0; x<n; x++){
				if(tag[x] && p[in][x] != 1) return 0; //harusnya 1
				if(!tag[x] && p[in][x] == 1) return 0;
			}
		}
		for(int i=0; i+1<vec.size(); i++){ // build
			bd(vec[i], vec[i+1]);
		}
	}

	for(int i=0; i<n; i++) adj[i][i] = 0;
	build(adj);
	return 1;
}

Compilation message

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:47:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |   for(int i=0; i+1<vec.size(); i++){ // build
      |                ~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 356 KB Output is correct
2 Correct 0 ms 360 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 8 ms 1368 KB Output is correct
7 Correct 148 ms 23932 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 356 KB Output is correct
2 Correct 0 ms 360 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 8 ms 1368 KB Output is correct
7 Correct 148 ms 23932 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 436 KB Output is correct
12 Correct 7 ms 1372 KB Output is correct
13 Correct 158 ms 24156 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 3 ms 860 KB Output is correct
17 Correct 78 ms 14212 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 39 ms 6400 KB Output is correct
21 Correct 162 ms 24076 KB Output is correct
22 Correct 154 ms 24068 KB Output is correct
23 Correct 158 ms 24164 KB Output is correct
24 Correct 163 ms 23968 KB Output is correct
25 Correct 63 ms 14164 KB Output is correct
26 Correct 62 ms 14212 KB Output is correct
27 Correct 155 ms 24148 KB Output is correct
28 Correct 154 ms 24000 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 600 KB Answer gives possible 1 while actual possible 0
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Too few ways to get from 0 to 1, should be 2 found 0
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 356 KB Output is correct
2 Correct 0 ms 360 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 8 ms 1368 KB Output is correct
7 Correct 148 ms 23932 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 436 KB Output is correct
12 Correct 7 ms 1372 KB Output is correct
13 Correct 158 ms 24156 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 3 ms 860 KB Output is correct
17 Correct 78 ms 14212 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 39 ms 6400 KB Output is correct
21 Correct 162 ms 24076 KB Output is correct
22 Correct 154 ms 24068 KB Output is correct
23 Correct 158 ms 24164 KB Output is correct
24 Correct 163 ms 23968 KB Output is correct
25 Correct 63 ms 14164 KB Output is correct
26 Correct 62 ms 14212 KB Output is correct
27 Correct 155 ms 24148 KB Output is correct
28 Correct 154 ms 24000 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Incorrect 0 ms 600 KB Answer gives possible 1 while actual possible 0
33 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 356 KB Output is correct
2 Correct 0 ms 360 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 8 ms 1368 KB Output is correct
7 Correct 148 ms 23932 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 436 KB Output is correct
12 Correct 7 ms 1372 KB Output is correct
13 Correct 158 ms 24156 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 3 ms 860 KB Output is correct
17 Correct 78 ms 14212 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 39 ms 6400 KB Output is correct
21 Correct 162 ms 24076 KB Output is correct
22 Correct 154 ms 24068 KB Output is correct
23 Correct 158 ms 24164 KB Output is correct
24 Correct 163 ms 23968 KB Output is correct
25 Correct 63 ms 14164 KB Output is correct
26 Correct 62 ms 14212 KB Output is correct
27 Correct 155 ms 24148 KB Output is correct
28 Correct 154 ms 24000 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Incorrect 0 ms 600 KB Answer gives possible 1 while actual possible 0
33 Halted 0 ms 0 KB -