답안 #1040504

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1040504 2024-08-01T06:28:40 Z 김은성(#10995) How to Avoid Disqualification in 75 Easy Steps (CEOI23_avoid) C++17
10 / 100
1 ms 348 KB
#include "avoid.h"
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#include <time.h>
#include <random>
using namespace std;
const int robot = 75;
bool ch[100][1009];
std::pair<int, int> scout(int R, int H) {
	int i, j, k, ans = 0;
	for (i = 0; i < 10; i++) {
		vector<int> vec, vec2;
		for (j = 1; j <= 1000; j++) {
			if (j & (1 << i)){
				vec.push_back(j);
			}
			else{
				vec2.push_back(j);
			}
		}
		send(vec);
		send(vec2);
	}
	vector<int> ret = wait();
	vector<int> crit;
	ans = 0;
	for(i=0; i<10; i++){
		if(ret[2*i] && ret[2*i+1])
			crit.push_back(i);
		else if(ret[2*i])
			ans |= (1<<i);
	}
	if(crit.empty()){
		return make_pair(ans, ans);
	}
	int tot = 0, sub = 0;
	for(i=0; i<crit.size(); i++)
		tot |= (1<<crit[i]);
	int last = 0;
	for(i=0; i+1<crit.size(); i++){
		vector<int> vec;
		for (j = 1; j <= 1000; j++) {
			if ((j & (1 << crit[i])) && (j & (1<<crit[i+1]))){
				vec.push_back(j);
			}
		}
		send(vec);
	}
	ret = wait();
	for(i=0; i+1<crit.size(); i++){
		if(!ret[i])
			last = 1-last;
		sub += last * (1<<(crit[i+1]));
	}
	return make_pair(ans+sub, ans+tot-sub);
	//end
	for(i=1; i<=1000; i++){
		for(j=1; j<=1000; j++){
			for(k=0; k<robot; k++){
				if(ret[k] != (ch[k][i] || ch[k][j]))
					break;
			}
			if(k==robot)
				return make_pair(i, j);
		}
	}
	return make_pair(-1, -1);
}

Compilation message

avoid.cpp: In function 'std::pair<int, int> scout(int, int)':
avoid.cpp:44:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |  for(i=0; i<crit.size(); i++)
      |           ~^~~~~~~~~~~~
avoid.cpp:47:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |  for(i=0; i+1<crit.size(); i++){
      |           ~~~^~~~~~~~~~~~
avoid.cpp:57:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |  for(i=0; i+1<crit.size(); i++){
      |           ~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct: 21 robot(s) used, 2 hour(s) passed
# 결과 실행 시간 메모리 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 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
2 Correct 0 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 0 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 344 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 1 ms 344 KB Correct: 26 robot(s) used, 2 hour(s) passed
13 Correct 1 ms 344 KB Correct: 26 robot(s) used, 2 hour(s) passed
14 Correct 1 ms 344 KB Correct: 26 robot(s) used, 2 hour(s) passed
15 Correct 1 ms 344 KB Correct: 22 robot(s) used, 2 hour(s) passed
16 Correct 0 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
17 Correct 0 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
18 Correct 1 ms 344 KB Correct: 20 robot(s) used, 2 hour(s) passed
19 Correct 0 ms 344 KB Correct: 22 robot(s) used, 2 hour(s) passed
20 Correct 1 ms 344 KB Correct: 22 robot(s) used, 2 hour(s) passed
21 Correct 1 ms 344 KB Correct: 21 robot(s) used, 2 hour(s) passed
22 Correct 0 ms 344 KB Correct: 20 robot(s) used, 2 hour(s) passed
23 Correct 0 ms 344 KB Correct: 22 robot(s) used, 2 hour(s) passed
24 Correct 0 ms 344 KB Correct: 24 robot(s) used, 2 hour(s) passed
25 Correct 0 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
26 Correct 0 ms 344 KB Correct: 21 robot(s) used, 2 hour(s) passed
27 Correct 0 ms 344 KB Correct: 21 robot(s) used, 2 hour(s) passed
28 Correct 0 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
29 Correct 0 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
30 Correct 0 ms 344 KB Correct: 22 robot(s) used, 2 hour(s) passed
31 Correct 1 ms 344 KB Correct: 25 robot(s) used, 2 hour(s) passed
32 Correct 1 ms 344 KB Correct: 22 robot(s) used, 2 hour(s) passed
33 Correct 1 ms 344 KB Correct: 22 robot(s) used, 2 hour(s) passed
34 Correct 1 ms 344 KB Correct: 22 robot(s) used, 2 hour(s) passed
35 Correct 0 ms 344 KB Correct: 24 robot(s) used, 2 hour(s) passed
36 Correct 0 ms 344 KB Correct: 24 robot(s) used, 2 hour(s) passed
37 Correct 1 ms 344 KB Correct: 25 robot(s) used, 2 hour(s) passed
38 Correct 0 ms 344 KB Correct: 22 robot(s) used, 2 hour(s) passed
39 Correct 1 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
40 Correct 0 ms 344 KB Correct: 21 robot(s) used, 2 hour(s) passed
41 Correct 1 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
42 Correct 0 ms 344 KB Correct: 21 robot(s) used, 2 hour(s) passed
43 Correct 1 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
44 Correct 1 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
45 Correct 0 ms 344 KB Correct: 22 robot(s) used, 2 hour(s) passed
46 Correct 0 ms 344 KB Correct: 22 robot(s) used, 2 hour(s) passed
47 Correct 0 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
48 Correct 0 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
49 Correct 1 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
50 Correct 0 ms 344 KB Correct: 20 robot(s) used, 1 hour(s) passed
51 Correct 0 ms 344 KB Correct: 25 robot(s) used, 2 hour(s) passed
52 Correct 0 ms 344 KB Correct: 24 robot(s) used, 2 hour(s) passed
53 Correct 1 ms 344 KB Correct: 21 robot(s) used, 2 hour(s) passed
54 Correct 1 ms 344 KB Correct: 24 robot(s) used, 2 hour(s) passed
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Not correct
2 Halted 0 ms 0 KB -