#include "avoid.h"
#include <vector>
#include<algorithm>
#include<random>
#include<chrono>
#include<utility>
#include<cassert>
#include<iostream>
#include<set>
using namespace std;
auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937 mt(seed);
// send(), wait()
std::pair<int, int> scout(int R, int H) {
vector<bool> poss(1001, 1);
int now = 0;
R = 48;
vector<vector<int>> asked;
set<pair<int, int>> s;
while(now <= R - 4){
int a, b;
if(now < 20){
a = now / 2;
b = now / 2 + 1;
}
else{
uniform_int_distribution<int> dis(0, 9);
a = dis(mt);
b = dis(mt);
if(a == b) continue;
if(a > b) swap(a, b);
if(s.count(make_pair(a, b))) continue;
}
now += 4;
s.insert(make_pair(a, b));
vector<int> a00, a01, a10, a11;
for(int i = 1; i <= 1000; i++){
if(i & (1 << a)){
if(i & (1 << b)) a11.push_back(i);
else a10.push_back(i);
}
else{
if(i & (1 << b)) a01.push_back(i);
else a00.push_back(i);
}
}
asked.push_back(a00);
send(a00);
asked.push_back(a01);
send(a01);
asked.push_back(a10);
send(a10);
asked.push_back(a11);
send(a11);
}
auto res = wait();
int sz = res.size();
for(int i = 0; i < sz; i++){
if(res[i] == 0){
for(auto &x: asked[i]) poss[x] = 0;
}
}
pair<int, int> ans;
vector<int> anss;
for(int i = 1; i <= 1000; i++) if(poss[i]) anss.push_back(i);
if(anss.size() == 1) ans.first = anss[0], ans.second = anss[0];
else ans.first = anss[1], ans.second = anss[0];
return ans;
}
// g++ -std=c++17 -o run ceoi23_d2C_grader.cpp ceoi23_d2C.cpp -fsanitize=undefined -fsanitize=address -Wall -Wextra -Wshadow
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |