답안 #205752

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
205752 2020-02-29T18:02:20 Z ly20 Political Development (BOI17_politicaldevelopment) C++17
0 / 100
6 ms 504 KB
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5123;
int grau[MAXN];
int tb[MAXN][MAXN];
int sq = sqrt(MAXN);
vector < int > ind;
vector <int> grafo[MAXN];
int main() {
	int n, k;
	scanf("%d %d", &n, &k);
	int resp = 1;
	for(int i = 0; i < n; i++) {
		int a;
		scanf("%d", &a); grau[i] = a;
		if(a > 0) resp = 2;
		if(a > sq) ind.push_back(i);
		for(int j = 0; j < a; j++) {
			int b;
			scanf("%d", &b);
			tb[i][b] = 1;
			grafo[i].push_back(b);
		}
	}
	for(int i = 0; i < n; i++) {
		if(grau[i] <= sq) {
			for(int j = 0; j < grafo[i].size(); j++) {
				for(int k = j + 1; k < grafo[i].size(); k++) {
					if(tb[j][k] == 1) resp = 3;
				}
			}
		}
	}
	for(int i = 0; i < ind.size(); i++) {
		for(int j = i + 1; j < ind.size(); j++) {
			for(int k = j + 1; k < ind.size(); k++) {
				if(tb[i][j] == 1 && tb[j][k] == 1 && tb[k][i] == 1) resp = 3;
			}
		}
	}
	printf("%d\n", resp);
	return 0;
}

Compilation message

politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:27:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int j = 0; j < grafo[i].size(); j++) {
                   ~~^~~~~~~~~~~~~~~~~
politicaldevelopment.cpp:28:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int k = j + 1; k < grafo[i].size(); k++) {
                        ~~^~~~~~~~~~~~~~~~~
politicaldevelopment.cpp:34:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < ind.size(); i++) {
                 ~~^~~~~~~~~~~~
politicaldevelopment.cpp:35:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j = i + 1; j < ind.size(); j++) {
                      ~~^~~~~~~~~~~~
politicaldevelopment.cpp:36:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int k = j + 1; k < ind.size(); k++) {
                       ~~^~~~~~~~~~~~
politicaldevelopment.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &k);
  ~~~~~^~~~~~~~~~~~~~~~~
politicaldevelopment.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &a); grau[i] = a;
   ~~~~~^~~~~~~~~~
politicaldevelopment.cpp:20:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d", &b);
    ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 504 KB Output is correct
2 Correct 5 ms 504 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Incorrect 5 ms 504 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -