답안 #130406

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
130406 2019-07-15T06:55:18 Z 김세빈(#3148) Information (CEOI08_information) C++14
42 / 100
214 ms 18680 KB
#include <bits/stdc++.h>

using namespace std;

vector <int> G[2020];
vector <int> A, B;
int P[2020], V[1010101];
bool chk1[2020], chk2[1010101];
int n, m, x;

void dfs1(int p, int r)
{
	chk1[p] = 1;
	
	if(r){
		A.push_back(r);
		chk2[r] = 1;
	}
	
	for(int &t: G[p]){
		if(!chk1[V[t]]){
			dfs1(V[t], t);
		}
	}
}

void dfs2(int p, int r)
{
	chk1[p] = 0;
	
	if(r){
		B.push_back(r);
	}
	
	for(int &t: G[p]){
		if(!chk2[t] && chk1[V[t]]){
			dfs2(V[t], t);
		}
	}
}

int main()
{
	int i, u;
	
	scanf("%d%d", &n, &m);
	
	for(i=1; i<=m; i++){
		scanf("%d%d", &u, V + i);
		G[u].emplace_back(i);
	}
	
	dfs1(1, 0); dfs2(1, 0);
	
	if(A.size() != n - 1 || B.size() != n - 1){
		return 1 / 0;
		printf("NONE\n");
	}
	else{
		for(int &t: A){
			printf("%d ", t);
		}
		
		printf("\n");
		
		for(int &t: B){
			printf("%d ", t);
		}
		
		printf("\n");
	}
	
	return 0;
}

Compilation message

information.cpp: In function 'int main()':
information.cpp:55:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if(A.size() != n - 1 || B.size() != n - 1){
     ~~~~~~~~~^~~~~~~~
information.cpp:55:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if(A.size() != n - 1 || B.size() != n - 1){
                          ~~~~~~~~~^~~~~~~~
information.cpp:56:12: warning: division by zero [-Wdiv-by-zero]
   return 1 / 0;
          ~~^~~
information.cpp:46:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &n, &m);
  ~~~~~^~~~~~~~~~~~~~~~
information.cpp:49:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &u, V + i);
   ~~~~~^~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 4 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 632 KB Execution killed with signal 4 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 556 KB Execution killed with signal 4 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 4 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 760 KB Execution killed with signal 4 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 632 KB Execution killed with signal 4 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 632 KB Execution killed with signal 4 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 632 KB Execution killed with signal 4 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 1400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 45 ms 4540 KB Execution killed with signal 4 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 24 ms 2808 KB Execution killed with signal 4 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 504 KB Output is correct
2 Runtime error 3 ms 632 KB Execution killed with signal 4 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 756 KB Execution killed with signal 4 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Correct 196 ms 8816 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 185 ms 9028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 214 ms 18680 KB Execution killed with signal 4 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 760 KB Execution killed with signal 4 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -