답안 #1040528

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1040528 2024-08-01T06:55:48 Z 변재우(#10999) How to Avoid Disqualification in 75 Easy Steps (CEOI23_avoid) C++17
9.99998 / 100
1 ms 344 KB
#include "avoid.h"
#include <bits/stdc++.h>
using namespace std;

pair<int, int> scout(int R, int H) {
  int a=0, b=0;
  for(int i=0; i<10; i++) {
    vector<int> T;
    for(int j=1; j<=1000; j++) if(!(j&(1<<i))) T.push_back(j);
    send(T);
  }
  for(int i=0; i<10; i++) {
    vector<int> T;
    for(int j=1; j<=1000; j++) if(j&(1<<i)) T.push_back(j);
    send(T);
  }
  for(int i=0; i<10; i++) {
    for(int j=i+1; j<10; j++) {
      vector<int> T;
      for(int k=1; k<=1000; k++) if((!(k&(1<<i))) && (k&(1<<j))) T.push_back(k);
      send(T);
    }
  }
  vector<int> T=wait(), V;
  int X[10][10]={0};
  for(int i=0; i<10; i++) {
    int l=T[i], r=T[i+10];
    if(l && r) V.push_back(i);
    if(!l) a|=(1<<i), b|=(1<<i);
  }
  int p=20;
  for(int i=0; i<10; i++) for(int j=i+1; j<10; j++) X[i][j]=T[p++];
  if(V.empty()) return {a, b};
  b|=(1<<V[0]);
  for(int i=0; i<V.size()-1; i++) {
    if(a&(1<<V[i])) {
      if(!X[V[i]][V[i+1]]) a|=(1<<V[i+1]);
      else b|=(1<<V[i+1]);
    }
    else {
      if(X[V[i]][V[i+1]]) a|=(1<<V[i+1]);
      else b|=(1<<V[i+1]);
    }
  }
  return {a, b};
}

Compilation message

avoid.cpp: In function 'std::pair<int, int> scout(int, int)':
avoid.cpp:35:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |   for(int i=0; i<V.size()-1; i++) {
      |                ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Correct: 65 robot(s) used, 1 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 Incorrect 1 ms 344 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Correct: 65 robot(s) used, 1 hour(s) passed
2 Correct 1 ms 344 KB Correct: 65 robot(s) used, 1 hour(s) passed
3 Correct 1 ms 344 KB Correct: 65 robot(s) used, 1 hour(s) passed
4 Correct 1 ms 344 KB Correct: 65 robot(s) used, 1 hour(s) passed
5 Correct 1 ms 344 KB Correct: 65 robot(s) used, 1 hour(s) passed
6 Correct 1 ms 344 KB Correct: 65 robot(s) used, 1 hour(s) passed
7 Correct 1 ms 344 KB Correct: 65 robot(s) used, 1 hour(s) passed
8 Correct 1 ms 344 KB Correct: 65 robot(s) used, 1 hour(s) passed
9 Correct 1 ms 344 KB Correct: 65 robot(s) used, 1 hour(s) passed
10 Correct 1 ms 344 KB Correct: 65 robot(s) used, 1 hour(s) passed
11 Correct 1 ms 344 KB Correct: 65 robot(s) used, 1 hour(s) passed
12 Correct 1 ms 344 KB Correct: 65 robot(s) used, 1 hour(s) passed
13 Correct 1 ms 344 KB Correct: 65 robot(s) used, 1 hour(s) passed
14 Correct 1 ms 344 KB Correct: 65 robot(s) used, 1 hour(s) passed
15 Correct 1 ms 344 KB Correct: 65 robot(s) used, 1 hour(s) passed