Submission #1197467

#TimeUsernameProblemLanguageResultExecution timeMemory
1197467adiyerFun Tour (APIO20_fun)C++20
0 / 100
53 ms13760 KiB
#include <bits/stdc++.h>
#include "fun.h"

using namespace std;

int a[1000][1000];

std::vector<int> createFunTour(int N, int Q) {
    int val = 0, st = 0;
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            a[i][j] = hoursRequired(i, j);
            if(a[i][j] >= val) st = i;
        }
    }
    vector < int > ans;
    int was[N] = {}, lst = st;
    was[lst] = 1, ans.push_back(lst);
    for(int i = 0; i < N - 1; i++){
        int k = -1;
        for(int j = 0; j < N; j++){
            if(!was[j]){
                if(k == -1 || a[lst][j] > a[lst][k]){
                    k = j;
                }
            }
        }
        was[k] = 1;
        ans.push_back(k);
        lst = k;
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...