답안 #735049

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
735049 2023-05-03T12:26:22 Z vjudge1 슈퍼트리 잇기 (IOI20_supertrees) C++17
11 / 100
166 ms 22028 KB
#include "supertrees.h"
#include<bits/stdc++.h>
#define INF 1e9+7
#define ll long long
#define ull unsigned ll
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pcc pair<char,char>
#define pdd pair<long double,long double>
#define pipii pair<int,pii>
#define plpll pair<ll,pll>
#define vi vector<int>
#define vvi vector<vi>
#define v3i vector<vvi>
#define v4i vector<v3i>
#define fi first
#define se second
#define mp make_pair
#define eb emplace_back
#define ins insert
#define ln '\n'
#define all(v) v.begin(),v.end()
#define bigint __int128

using namespace std;

int construct(vvi p) {
	int n = p.size();
    vvi answer(n,vi(n,0));
    vi color(n,0);
    int nxt=0;
    if(n==1){
        build(answer);
        return 1;
    }
    int flaq=0;
	for (int i=0;i<n;++i) {
		if(!color[i]){
            color[i]=++nxt;
            flaq=1;
		}
		for(int j=0;j<n;++j){
            if(p[i][j]==1){
                if(!color[j]){
                    color[j]=color[i];
                    if(flaq==0){
                        return 0;
                    }
                }
            }
		}
		flaq=0;
	}
	vvi node(nxt+1);
	for(int i=0;i<n;++i){
        node[color[i]].eb(i);
	}
	for(int i=1;i<=nxt;++i){
	    for(int j=1;j<node[i].size()-1;++j){
            answer[node[i][j]][node[i][j-1]]=answer[node[i][j]][node[i][j+1]]=1;
	    }
	    if(node[i].size()!=1){
            answer[node[i][0]][node[i][1]]=answer[node[i][node[i].size()-1]][node[i][node[i].size()-2]]=1;
	    }
	}
	build(answer);
	return 1;
}

Compilation message

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:59:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |      for(int j=1;j<node[i].size()-1;++j){
      |                  ~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 7 ms 1108 KB Output is correct
7 Correct 166 ms 22024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 7 ms 1108 KB Output is correct
7 Correct 166 ms 22024 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 161 ms 22028 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 4 ms 820 KB Output is correct
17 Correct 74 ms 14080 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Incorrect 1 ms 296 KB Answer gives possible 1 while actual possible 0
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Answer gives possible 1 while actual possible 0
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 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 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 7 ms 1108 KB Output is correct
7 Correct 166 ms 22024 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 161 ms 22028 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 4 ms 820 KB Output is correct
17 Correct 74 ms 14080 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Incorrect 1 ms 296 KB Answer gives possible 1 while actual possible 0
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 7 ms 1108 KB Output is correct
7 Correct 166 ms 22024 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 161 ms 22028 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 4 ms 820 KB Output is correct
17 Correct 74 ms 14080 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Incorrect 1 ms 296 KB Answer gives possible 1 while actual possible 0
20 Halted 0 ms 0 KB -