답안 #1065623

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1065623 2024-08-19T10:03:58 Z ReLice 가장 긴 여행 (IOI23_longesttrip) C++17
15 / 100
870 ms 1100 KB
#include "longesttrip.h"
#include <bits/stdc++.h>
#define ll int
#define pb push_back
#define ins insert
#define fr first
#define sc second
#define vll vector<ll>
#define sz size()
#define pf push_front
#define bc back()
using namespace std;

const ll N = 260;
const ll inf = 1e9 + 7;

ll g[N][N];
bool vis[N];

vector<int> longest_trip(int n, int D){
	ll i,j;
	
	for(i=0;i<n;i++){
		for(j=0;j<n;j++) g[i][j] = 0;
		vis[i] = 0;
	}
	
	for(i=0;i<n;i++){
		for(j=i+1;j<n;j++){
			if(are_connected({i},{j})){
				g[i][j] = g[j][i] = 1;
			}
		}
	}
	
	deque<ll> v;
	v.pb(0);
	for(i=0;i<n;i++){
		if(g[0][i]){v.pb(i);break;}
	}
	
	vis[v[0]] = 1;
	vis[v[1]] = 1;
	
	for(i=0;i<n;i++){
		if(vis[i])continue;
		if(g[v[0]][i]) v.pf(i);
		else if(g[v.bc][i]) v.pb(i);
	}
	
	vll ans;
	for(auto i : v) ans.pb(i);
	
	return ans;
}



# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 203 ms 680 KB Incorrect
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 344 KB Output is correct
2 Correct 30 ms 344 KB Output is correct
3 Correct 152 ms 344 KB Output is correct
4 Correct 363 ms 552 KB Output is correct
5 Correct 845 ms 1100 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 19 ms 344 KB Output is correct
3 Correct 123 ms 344 KB Output is correct
4 Correct 405 ms 592 KB Output is correct
5 Correct 858 ms 680 KB Output is correct
6 Correct 7 ms 344 KB Output is correct
7 Correct 21 ms 344 KB Output is correct
8 Correct 143 ms 344 KB Output is correct
9 Correct 308 ms 592 KB Output is correct
10 Correct 837 ms 676 KB Output is correct
11 Correct 817 ms 684 KB Output is correct
12 Correct 773 ms 684 KB Output is correct
13 Correct 832 ms 680 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 344 KB Output is correct
2 Correct 21 ms 344 KB Output is correct
3 Correct 158 ms 344 KB Output is correct
4 Correct 406 ms 548 KB Output is correct
5 Correct 830 ms 680 KB Output is correct
6 Correct 10 ms 344 KB Output is correct
7 Correct 39 ms 344 KB Output is correct
8 Correct 142 ms 344 KB Output is correct
9 Correct 315 ms 520 KB Output is correct
10 Correct 814 ms 680 KB Output is correct
11 Correct 820 ms 696 KB Output is correct
12 Correct 821 ms 680 KB Output is correct
13 Correct 797 ms 680 KB Output is correct
14 Correct 5 ms 344 KB Output is correct
15 Incorrect 2 ms 344 KB Incorrect
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 344 KB Output is correct
2 Correct 18 ms 344 KB Output is correct
3 Partially correct 146 ms 344 KB Output is partially correct
4 Partially correct 412 ms 544 KB Output is partially correct
5 Partially correct 845 ms 680 KB Output is partially correct
6 Correct 6 ms 344 KB Output is correct
7 Correct 21 ms 340 KB Output is correct
8 Partially correct 163 ms 344 KB Output is partially correct
9 Partially correct 339 ms 592 KB Output is partially correct
10 Partially correct 870 ms 680 KB Output is partially correct
11 Partially correct 820 ms 680 KB Output is partially correct
12 Partially correct 851 ms 676 KB Output is partially correct
13 Partially correct 818 ms 676 KB Output is partially correct
14 Incorrect 0 ms 344 KB Incorrect
15 Halted 0 ms 0 KB -