답안 #1069759

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1069759 2024-08-22T08:46:15 Z UmairAhmadMirza 가장 긴 여행 (IOI23_longesttrip) C++17
5 / 100
382 ms 700 KB
#include <bits/stdc++.h>
using namespace std;
 
bool are_connected(vector<int> A, vector<int> B);
 
int const MAXN=260;
bool con[MAXN][MAXN];
vector<int> path,longest;
bool vis[MAXN];
int nn;
void dfs(int node){
	path.push_back(node);
	if(path.size()>longest.size())
		longest=path;
	vis[node]=1;
	for(int i=0;i<nn;i++)
		if(vis[i]==0 && are_connected({node},{i}))
			dfs(i);
	path.pop_back();
}
vector<int> longest_trip(int n, int D){
	longest.clear();
	nn=n;
	for (int i = 0; i < n; ++i)
	{
		path.clear();
		for(int j=0;j<n;j++)
			vis[j]=0;
		dfs(i);
		if(longest.size()*2>=n)
			break;
	}
	return longest;
}

Compilation message

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:30:22: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |   if(longest.size()*2>=n)
      |      ~~~~~~~~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 7 ms 344 KB Output is correct
5 Correct 6 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 6 ms 600 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
5 Correct 7 ms 344 KB Output is correct
6 Incorrect 0 ms 344 KB Incorrect
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 7 ms 344 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
5 Correct 6 ms 344 KB Output is correct
6 Correct 9 ms 344 KB Output is correct
7 Correct 9 ms 344 KB Output is correct
8 Correct 5 ms 344 KB Output is correct
9 Correct 5 ms 344 KB Output is correct
10 Correct 6 ms 344 KB Output is correct
11 Correct 8 ms 344 KB Output is correct
12 Correct 5 ms 508 KB Output is correct
13 Correct 5 ms 344 KB Output is correct
14 Correct 6 ms 340 KB Output is correct
15 Correct 12 ms 344 KB Output is correct
16 Correct 8 ms 344 KB Output is correct
17 Correct 10 ms 344 KB Output is correct
18 Correct 6 ms 344 KB Output is correct
19 Correct 6 ms 344 KB Output is correct
20 Correct 6 ms 344 KB Output is correct
21 Correct 6 ms 344 KB Output is correct
22 Correct 6 ms 344 KB Output is correct
23 Correct 6 ms 344 KB Output is correct
24 Correct 7 ms 344 KB Output is correct
25 Correct 10 ms 344 KB Output is correct
26 Correct 7 ms 344 KB Output is correct
27 Correct 10 ms 344 KB Output is correct
28 Correct 9 ms 344 KB Output is correct
29 Correct 9 ms 344 KB Output is correct
30 Correct 13 ms 344 KB Output is correct
31 Correct 97 ms 344 KB Output is correct
32 Correct 104 ms 344 KB Output is correct
33 Correct 14 ms 700 KB Output is correct
34 Correct 19 ms 344 KB Output is correct
35 Correct 40 ms 344 KB Output is correct
36 Correct 10 ms 344 KB Output is correct
37 Correct 58 ms 344 KB Output is correct
38 Correct 249 ms 592 KB Output is correct
39 Correct 364 ms 344 KB Output is correct
40 Incorrect 382 ms 448 KB too many calls
41 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 340 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 6 ms 444 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
5 Correct 6 ms 344 KB Output is correct
6 Incorrect 0 ms 344 KB Incorrect
7 Halted 0 ms 0 KB -