답안 #1007091

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1007091 2024-06-24T11:44:07 Z edogawa_something 가장 긴 여행 (IOI23_longesttrip) C++17
5 / 100
7 ms 436 KB
#include "longesttrip.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vii;
typedef pair<ll,ll> pii;
#define pb push_back
#define F first 
#define S second 
#define all(v) v.begin(),v.end()
const int M=1010;
const ll inf=1e18;
std::vector<int> longest_trip(int N, int D)
{
    vector<int>v1,v2;
    for(int i=0;i<N;i++){
        if(v1.empty()){
        v1.pb(i);
        continue;
        }
        if(are_connected({i},{v1.back()})){
            v1.pb(i);
            continue;
        }
        if(v2.empty()){
            v2.pb(i);
            continue;
        }
        if(are_connected({i},{v2.back()})){
            v2.pb(i);
            continue;
        }
        reverse(all(v2));
        for(auto it:v2)
        v1.pb(it);
        v2.pb(i);
    }
    if(v1.size()>v2.size())
    swap(v1,v2);
    return v2;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 2 ms 428 KB Incorrect
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 344 KB Output is correct
2 Correct 6 ms 344 KB Output is correct
3 Correct 7 ms 344 KB Output is correct
4 Correct 7 ms 344 KB Output is correct
5 Correct 7 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 344 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 7 ms 344 KB Output is correct
5 Correct 5 ms 344 KB Output is correct
6 Incorrect 0 ms 344 KB Incorrect
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 344 KB Output is correct
2 Correct 7 ms 344 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 3 ms 344 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 7 ms 344 KB Output is correct
8 Correct 6 ms 344 KB Output is correct
9 Correct 6 ms 344 KB Output is correct
10 Correct 5 ms 436 KB Output is correct
11 Correct 5 ms 344 KB Output is correct
12 Correct 6 ms 344 KB Output is correct
13 Correct 7 ms 344 KB Output is correct
14 Correct 4 ms 344 KB Output is correct
15 Correct 5 ms 344 KB Output is correct
16 Incorrect 1 ms 344 KB Incorrect
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 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 5 ms 344 KB Output is correct
5 Correct 5 ms 344 KB Output is correct
6 Incorrect 0 ms 344 KB Incorrect
7 Halted 0 ms 0 KB -