Submission #1078459

# Submission time Handle Problem Language Result Execution time Memory
1078459 2024-08-27T17:43:49 Z vjudge1 Longest Trip (IOI23_longesttrip) C++17
15 / 100
9 ms 600 KB
#include "longesttrip.h"
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);    cin.tie(0);
#define vi vector<int>
#define ll long long
#define ff first
#define ss second
using namespace std;
const int MAX=3e3+5;

vector<int> longest_trip(int n,int d){
    vector<int>a;
    a.push_back(0);
    vector<int>b;
    b.push_back(1);
    int x=0;
    int y=0;
    deque<int>ans;
    if(are_connected(a,b)){
        x=0;
        y=1;
        ans.push_back(0);
        ans.push_back(1);
    }
    else{
        x=0;
        y=1;
        ans.push_back(0);
        ans.push_back(2);
        ans.push_back(1);
    }
    for(int i=2;i<n;i++){
        if(ans.size()==3 and i==2)   continue;
        a.pop_back();   b.pop_back();
        a.push_back(y); b.push_back(i); 
        if(are_connected(a,b)){
            y=i;
            ans.push_back(i);
        }
        else{
            ans.push_front(i);
        }
    }
    vector<int>v;
    for(auto it:ans){
        v.push_back(it);
    }
    return v;
}

Compilation message

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:16:9: warning: variable 'x' set but not used [-Wunused-but-set-variable]
   16 |     int x=0;
      |         ^
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 5 ms 344 KB Output is correct
5 Correct 5 ms 344 KB Output is correct
# Verdict Execution time Memory 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 5 ms 388 KB Output is correct
5 Correct 5 ms 344 KB Output is correct
6 Correct 7 ms 344 KB Output is correct
7 Correct 5 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 7 ms 432 KB Output is correct
11 Correct 4 ms 600 KB Output is correct
12 Correct 6 ms 344 KB Output is correct
13 Correct 5 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 8 ms 344 KB Output is correct
4 Correct 7 ms 600 KB Output is correct
5 Correct 5 ms 344 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 4 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 5 ms 344 KB Output is correct
11 Correct 5 ms 344 KB Output is correct
12 Correct 5 ms 344 KB Output is correct
13 Correct 4 ms 344 KB Output is correct
14 Incorrect 0 ms 344 KB Incorrect
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 5 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 5 ms 344 KB Output is correct
8 Correct 7 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 5 ms 440 KB Output is correct
12 Correct 6 ms 344 KB Output is correct
13 Correct 9 ms 344 KB Output is correct
14 Incorrect 0 ms 344 KB Incorrect
15 Halted 0 ms 0 KB -