답안 #735012

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
735012 2023-05-03T11:17:50 Z vjudge1 슈퍼트리 잇기 (IOI20_supertrees) C++17
11 / 100
165 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;
    }
	for (int i=0;i<=n-1;++i) {
		if(!color[i]){
            color[i]=++nxt;
		}
		for(int j=0;j<=n-1;++j){
            if(p[i][j]==1){
                if(!color[j]){
                    color[j]=color[i];
                }
                else{
                    if(color[i]!=color[j]){
                        return 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;
	    }
        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:58:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |      for(int j=1;j<node[i].size()-1;++j){
      |                  ~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 8 ms 1108 KB Output is correct
7 Correct 165 ms 22028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 8 ms 1108 KB Output is correct
7 Correct 165 ms 22028 KB Output is correct
8 Incorrect 0 ms 212 KB b is not symmetric: b[0][1] (0) != b[1][0] (1)
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB b is not symmetric: b[0][1] (0) != b[1][0] (1)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB b is not symmetric: b[0][1] (0) != b[1][0] (1)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 8 ms 1108 KB Output is correct
7 Correct 165 ms 22028 KB Output is correct
8 Incorrect 0 ms 212 KB b is not symmetric: b[0][1] (0) != b[1][0] (1)
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 8 ms 1108 KB Output is correct
7 Correct 165 ms 22028 KB Output is correct
8 Incorrect 0 ms 212 KB b is not symmetric: b[0][1] (0) != b[1][0] (1)
9 Halted 0 ms 0 KB -