#include "avoid.h"
#include <vector>
#include<algorithm>
#include<random>
#include<chrono>
#include<utility>
#include<cassert>
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<int> vec(1000);
for(int i = 0; i < 1000; i++) vec[i] = i + 1;
vector<bool> poss(1001, 1);
int now = 0;
vector<vector<int>> asked;
while(now <= R - 10){
now += 2;
shuffle(vec.begin(), vec.end(), mt);
vector<int> ask1, ask2;
for(int i = 0; i < 333; i++) ask1.push_back(vec[i]);
for(int i = 0; i < 333; i++) ask2.push_back(vec[i + 500]);
send(ask1);
send(ask2);
asked.push_back(ask1);
asked.push_back(ask2);
}
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);
assert(anss.size() <= 2);
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 |
Correct |
1 ms |
344 KB |
Correct: 66 robot(s) used, 1 hour(s) passed |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
600 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
444 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
508 KB |
Correct: 66 robot(s) used, 1 hour(s) passed |
2 |
Correct |
2 ms |
508 KB |
Correct: 66 robot(s) used, 1 hour(s) passed |
3 |
Correct |
1 ms |
508 KB |
Correct: 66 robot(s) used, 1 hour(s) passed |
4 |
Correct |
1 ms |
344 KB |
Correct: 66 robot(s) used, 1 hour(s) passed |
5 |
Correct |
1 ms |
508 KB |
Correct: 66 robot(s) used, 1 hour(s) passed |
6 |
Correct |
1 ms |
512 KB |
Correct: 66 robot(s) used, 1 hour(s) passed |
7 |
Correct |
1 ms |
504 KB |
Correct: 66 robot(s) used, 1 hour(s) passed |
8 |
Correct |
1 ms |
344 KB |
Correct: 66 robot(s) used, 1 hour(s) passed |
9 |
Correct |
1 ms |
508 KB |
Correct: 66 robot(s) used, 1 hour(s) passed |
10 |
Correct |
1 ms |
344 KB |
Correct: 66 robot(s) used, 1 hour(s) passed |
11 |
Correct |
1 ms |
528 KB |
Correct: 66 robot(s) used, 1 hour(s) passed |
12 |
Correct |
1 ms |
484 KB |
Correct: 66 robot(s) used, 1 hour(s) passed |
13 |
Correct |
1 ms |
520 KB |
Correct: 66 robot(s) used, 1 hour(s) passed |
14 |
Correct |
1 ms |
344 KB |
Correct: 66 robot(s) used, 1 hour(s) passed |
15 |
Correct |
1 ms |
344 KB |
Correct: 66 robot(s) used, 1 hour(s) passed |