This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#include "island.h"
typedef long long ll;
#define pi pair<int, int>
#define pii pair<int, pi>
#define fi first
#define se second
#ifdef _WIN32
#define getchar_unlocked _getchar_nolock
#endif
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
void solve(int N, int L) {
vector <int> order;
for(int i = 1; i < N; i++)order.push_back(query(1, i));
set <int> s;
set <int> ss;
ss.insert(1);
s.insert(1);
for(int i = 0; i < (int)order.size(); i++){
int cnt = 1;
if(ss.find(order[i]) != ss.end()){
s.insert(order[i]);
continue;
}
while(1){
int res = query(order[i], cnt);
cnt++;
answer(res, order[i]);
ss.insert(res);
if(s.find(res) != s.end()){
break;
}
}
s.insert(order[i]);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |