답안 #1072032

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1072032 2024-08-23T13:33:49 Z NeroZein How to Avoid Disqualification in 75 Easy Steps (CEOI23_avoid) C++17
25 / 100
2 ms 600 KB
#include "avoid.h"
#include <bits/stdc++.h>

using namespace std; 

const int LOG = 10;

pair<int, int> scout(int R, int H) {
	int n = 1000;
	if (H == 1) {
		for (int j = 0; j < LOG; ++j) {
			vector<int> vec; 
			for (int i = 1; i <= n; ++i) {
			  if (i >> j & 1) {
				  vec.push_back(i); 
			  }
			}
			send(vec);
		}
		vector<int> res = wait();
		int a = 0, b = 0;
		for (int j = 0; j < LOG; ++j) {
			if (res[j]) {
				a += 1 << j;
				b += 1 << j; 
			}
		}
		return {a, b};
	} else if (H == 20) {
		int l = 1, r = n;
		while (l < r) {
			int mid = (l + r) >> 1;
			vector<int> vec; 
			for (int i = 1; i <= mid; ++i) {
				vec.push_back(i);
			}
			send(vec);
			vector<int> res = wait();
			if (res[0] == 1) {
				r = mid;
			} else {
				l = mid + 1; 
			}
		}
		int a = l;
		l = 1, r = n;
		while (l < r) {
			int mid = (l + r + 1) >> 1;
			vector<int> vec;
			for (int i = n; i >= mid; --i) {
				vec.push_back(i);
			}
			send(vec);
			vector<int> res = wait();
			if (res[0] == 1) {
				l = mid;
			} else {
				r = mid - 1; 
			}
		}
		int b = l;
		return {a, b}; 
	}
	for (int j = 0; j < LOG; ++j) {
		vector<int> vec[2]; 
		for (int i = 1; i <= n; ++i) {
			vec[i >> j & 1].push_back(i);
		}
		send(vec[0]);
		send(vec[1]);
	}
	vector<int> res = wait();
	assert((int) res.size() == 2 * LOG);
	vector<int> same(LOG, -1);
	int a = 0, b = 0; 
	for (int j = 0, cur = 0; j < LOG; ++j, cur += 2) {
		if (res[cur] == 1 && res[cur + 1] == 0) {
			same[j] = 0; 
		} else if (res[cur] == 0 && res[cur + 1] == 1) {
			same[j] = 1; 
			a += (1 << j);
			b += (1 << j); 
		}
	}
	int msb = -1;
	for (int j = LOG - 1; j >= 0; --j) {
		if (same[j] == -1) {
			msb = j; 
			break; 
		}
	}
	if (msb == -1) {
		return {a, b}; 
	}
	b += (1 << msb);
	for (int j = 0; j < msb; ++j) {
		vector<int> vec[2]; 
		for (int i = 1; i <= n; ++i) {
			if (i >> msb & 1) {
				vec[i >> j & 1].push_back(i);
			}
		}
		send(vec[1]);
	}
	res = wait();
	for (int j = 0; j < msb; ++j) {
		if (same[j] != -1) {
			continue; 
		}
		if (res[j] == 1) {
			b += (1 << j);
		} else {
			a += (1 << j);
		}
	}
	return {a, b}; 
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Correct: 20 robot(s) used, 20 hour(s) passed
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Correct: 10 robot(s) used, 1 hour(s) passed
2 Correct 1 ms 344 KB Correct: 10 robot(s) used, 1 hour(s) passed
3 Correct 1 ms 344 KB Correct: 10 robot(s) used, 1 hour(s) passed
4 Correct 1 ms 344 KB Correct: 10 robot(s) used, 1 hour(s) passed
5 Correct 0 ms 344 KB Correct: 10 robot(s) used, 1 hour(s) passed
6 Correct 1 ms 344 KB Correct: 10 robot(s) used, 1 hour(s) passed
7 Correct 1 ms 344 KB Correct: 10 robot(s) used, 1 hour(s) passed
8 Correct 1 ms 344 KB Correct: 10 robot(s) used, 1 hour(s) passed
9 Correct 1 ms 344 KB Correct: 10 robot(s) used, 1 hour(s) passed
10 Correct 0 ms 344 KB Correct: 10 robot(s) used, 1 hour(s) passed
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
2 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
3 Correct 2 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
4 Correct 1 ms 440 KB Correct: 20 robot(s) used, 20 hour(s) passed
5 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
6 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
7 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
8 Correct 1 ms 600 KB Correct: 20 robot(s) used, 20 hour(s) passed
9 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
10 Correct 2 ms 452 KB Correct: 20 robot(s) used, 20 hour(s) passed
11 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
12 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
13 Correct 1 ms 452 KB Correct: 20 robot(s) used, 20 hour(s) passed
14 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
15 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
16 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
17 Correct 2 ms 440 KB Correct: 20 robot(s) used, 20 hour(s) passed
18 Correct 1 ms 448 KB Correct: 20 robot(s) used, 20 hour(s) passed
19 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
20 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
21 Correct 1 ms 444 KB Correct: 20 robot(s) used, 20 hour(s) passed
22 Correct 1 ms 440 KB Correct: 20 robot(s) used, 20 hour(s) passed
23 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
24 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
25 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
26 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
27 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
28 Correct 1 ms 444 KB Correct: 20 robot(s) used, 20 hour(s) passed
29 Correct 1 ms 444 KB Correct: 20 robot(s) used, 20 hour(s) passed
30 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
31 Correct 1 ms 448 KB Correct: 20 robot(s) used, 20 hour(s) passed
32 Correct 1 ms 448 KB Correct: 20 robot(s) used, 20 hour(s) passed
33 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
34 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
35 Correct 1 ms 340 KB Correct: 20 robot(s) used, 20 hour(s) passed
36 Correct 1 ms 440 KB Correct: 20 robot(s) used, 20 hour(s) passed
37 Correct 1 ms 444 KB Correct: 20 robot(s) used, 20 hour(s) passed
38 Correct 1 ms 444 KB Correct: 19 robot(s) used, 19 hour(s) passed
39 Correct 1 ms 444 KB Correct: 20 robot(s) used, 20 hour(s) passed
40 Correct 1 ms 440 KB Correct: 20 robot(s) used, 20 hour(s) passed
41 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
42 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
43 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
44 Correct 1 ms 440 KB Correct: 20 robot(s) used, 20 hour(s) passed
45 Correct 0 ms 344 KB Correct: 19 robot(s) used, 19 hour(s) passed
46 Correct 1 ms 340 KB Correct: 20 robot(s) used, 20 hour(s) passed
47 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
48 Correct 0 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
49 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
50 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
51 Correct 1 ms 344 KB Correct: 19 robot(s) used, 19 hour(s) passed
52 Correct 0 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
53 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
54 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
55 Correct 1 ms 344 KB Correct: 20 robot(s) used, 20 hour(s) passed
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
2 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
3 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
4 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
5 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
6 Correct 1 ms 344 KB Correct: 20 robot(s) used, 1 hour(s) passed
7 Correct 1 ms 344 KB Correct: 20 robot(s) used, 1 hour(s) passed
8 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
9 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
10 Correct 1 ms 404 KB Correct: 29 robot(s) used, 2 hour(s) passed
11 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
12 Correct 2 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
13 Correct 1 ms 344 KB Correct: 28 robot(s) used, 2 hour(s) passed
14 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
15 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
16 Correct 1 ms 344 KB Correct: 28 robot(s) used, 2 hour(s) passed
17 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
18 Correct 1 ms 344 KB Correct: 25 robot(s) used, 2 hour(s) passed
19 Correct 1 ms 504 KB Correct: 28 robot(s) used, 2 hour(s) passed
20 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
21 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
22 Correct 1 ms 344 KB Correct: 26 robot(s) used, 2 hour(s) passed
23 Correct 1 ms 344 KB Correct: 28 robot(s) used, 2 hour(s) passed
24 Correct 1 ms 344 KB Correct: 26 robot(s) used, 2 hour(s) passed
25 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
26 Correct 1 ms 344 KB Correct: 26 robot(s) used, 2 hour(s) passed
27 Correct 1 ms 344 KB Correct: 25 robot(s) used, 2 hour(s) passed
28 Correct 1 ms 344 KB Correct: 28 robot(s) used, 2 hour(s) passed
29 Correct 1 ms 344 KB Correct: 24 robot(s) used, 2 hour(s) passed
30 Correct 1 ms 344 KB Correct: 28 robot(s) used, 2 hour(s) passed
31 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
32 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
33 Correct 1 ms 344 KB Correct: 21 robot(s) used, 2 hour(s) passed
34 Correct 1 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
35 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
36 Correct 1 ms 344 KB Correct: 28 robot(s) used, 2 hour(s) passed
37 Correct 1 ms 344 KB Correct: 28 robot(s) used, 2 hour(s) passed
38 Correct 1 ms 344 KB Correct: 27 robot(s) used, 2 hour(s) passed
39 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
40 Correct 1 ms 344 KB Correct: 24 robot(s) used, 2 hour(s) passed
41 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
42 Correct 1 ms 344 KB Correct: 28 robot(s) used, 2 hour(s) passed
43 Correct 1 ms 344 KB Correct: 20 robot(s) used, 2 hour(s) passed
44 Correct 1 ms 344 KB Correct: 28 robot(s) used, 2 hour(s) passed
45 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
46 Correct 1 ms 344 KB Correct: 27 robot(s) used, 2 hour(s) passed
47 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
48 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
49 Correct 1 ms 344 KB Correct: 28 robot(s) used, 2 hour(s) passed
50 Correct 1 ms 596 KB Correct: 24 robot(s) used, 2 hour(s) passed
51 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
52 Correct 1 ms 344 KB Correct: 28 robot(s) used, 2 hour(s) passed
53 Correct 1 ms 344 KB Correct: 26 robot(s) used, 2 hour(s) passed
54 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Not correct
2 Halted 0 ms 0 KB -