Submission #978238

#TimeUsernameProblemLanguageResultExecution timeMemory
978238model_codeIsland Hopping (JOI24_island)C++17
100 / 100
6 ms600 KiB
#include "island.h" #include <vector> #include <algorithm> using namespace std; void solve(int N, int L){ vector<int> dist(N, 0), near(N, 0), ok(N, 0); dist[0] = 0; near[0] = 0; for(int i = 1; i < N; i++){ int a = query(1, i) - 1; dist[a] = i; near[i] = a; } for(int t = 1; t < N; t++){ int i = near[t]; if(ok[i]){ continue; } for(int j = 1; j < N; j++){ int a = query(i + 1, j) - 1; if(dist[a] < dist[i]){ answer(i + 1, a + 1); break; } else{ answer(i + 1, a + 1); ok[a] = 1; } } } }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...