답안 #1008701

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1008701 2024-06-26T16:48:32 Z Abito 가장 긴 여행 (IOI23_longesttrip) C++17
5 / 100
1000 ms 564 KB
#include "longesttrip.h"
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
std::vector<int> longest_trip(int n, int D)
{
    vector<int> v;
    vector<bool> vis(n);
    v.pb(0);
    bool adj[n][n],calc[n][n];
    for (int i=0;i<n;i++) for (int j=0;j<n;j++) adj[i][j]=calc[i][j]=0;
    while (v.size()<n){
        vis[v.back()]=1;
        for (int i=0;i<n;i++){
            if (vis[i]) continue;
            if (calc[v.back()][i]){
                if (adj[v.back()][i]){
                    v.pb(i);
                    break;
                }
                continue;
            }
            vector<int> x,y;x.pb(v.back());y.pb(i);
            calc[v.back()][i]=calc[i][v.back()]=true;
            adj[v.back()][i]=adj[i][v.back()]=are_connected(x,y);
            if (!adj[v.back()][i]) continue;
            v.pb(i);
            break;
        }
    }
    return v;
}

Compilation message

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:12:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   12 |     while (v.size()<n){
      |            ~~~~~~~~^~
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3050 ms 344 KB Time limit exceeded
2 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 5 ms 344 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
5 Correct 5 ms 564 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 4 ms 344 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
5 Correct 8 ms 344 KB Output is correct
6 Execution timed out 3073 ms 344 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 5 ms 352 KB Output is correct
3 Correct 7 ms 344 KB Output is correct
4 Correct 6 ms 344 KB Output is correct
5 Correct 5 ms 344 KB Output is correct
6 Execution timed out 3099 ms 344 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 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 7 ms 344 KB Output is correct
5 Correct 5 ms 344 KB Output is correct
6 Execution timed out 3057 ms 344 KB Time limit exceeded
7 Halted 0 ms 0 KB -