답안 #1040463

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1040463 2024-08-01T05:07:49 Z 김은성(#10995) The Ties That Guide Us (CEOI23_incursion) C++17
0 / 100
66 ms 7304 KB
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include "incursion.h"
using namespace std;
typedef long long ll;
const ll INF = 0x3fffffffffffffff;
int d[45009];
bool ch[45009];
vector<int> graph[45009];
void dfs(int v){
	ch[v] = 1;
	for(int i=0; i<graph[v].size(); i++){
		int u = graph[v][i];
		if(ch[u])
			continue;
		d[u] = d[v] + 1;
	}
}
std::vector<int> mark(std::vector<std::pair<int, int>> F, int safe) {
	int n = (int)F.size() + 1, i;
	//printf("n=%d\n", n);
	for(i=0; i<n-1; i++){
		graph[F[i].first].push_back(F[i].second);
		graph[F[i].second].push_back(F[i].first);
	}
	dfs(safe);
	vector<int> ret(n);
	for(i=0; i<n; i++)
		ret[i] = d[i];
	return ret;
}
void go(int v, int t){
	if(t==0)
		return;
	ch[v] = 1;
	for(int i=0; i<graph[v].size(); i++){
		int u = graph[v][i];
		if(ch[u])
			continue;
		int ans = visit(u);
		if(ans < t)
			go(u, ans);
		else
			visit(v);
	}
}
void locate(std::vector<std::pair<int, int>> F, int curr, int t) {
	int n = (int)F.size() + 1, i;
	for(i=0; i<n; i++){
		graph[i].clear();
		ch[i] = 0;
	}
	for(i=0; i<n-1; i++){
		graph[F[i].first].push_back(F[i].second);
		graph[F[i].second].push_back(F[i].first);
	}
	go(curr, t);
}

Compilation message

incursion.cpp: In function 'void dfs(int)':
incursion.cpp:19:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |  for(int i=0; i<graph[v].size(); i++){
      |               ~^~~~~~~~~~~~~~~~
incursion.cpp: In function 'void go(int, int)':
incursion.cpp:43:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |  for(int i=0; i<graph[v].size(); i++){
      |               ~^~~~~~~~~~~~~~~~
interface.cpp: In function 'int main()':
interface.cpp:44:55: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   44 |     if(fread(T.data(), sizeof(int), 2 * N - 2, stdin) != 2 * N - 2) exit(0);
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
interface.cpp:50:33: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   50 |         int l = (numbers.size() == N ? N : 0);
      |                  ~~~~~~~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2820 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 63 ms 7244 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 66 ms 7144 KB Correct
2 Incorrect 64 ms 7304 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2820 KB Not correct
2 Halted 0 ms 0 KB -