Submission #1224507

#TimeUsernameProblemLanguageResultExecution timeMemory
1224507LaMatematica14How to Avoid Disqualification in 75 Easy Steps (CEOI23_avoid)C++20
10 / 100
1 ms428 KiB
#include "avoid.h"
#include <bits/stdc++.h>
using namespace std;

pair<int, int> scout(int R, int H) {
  int pos1 = 0, pos2 = 0;
  auto question = [&](int ok, int fi) -> void {
    vector<int> ask, askk;
    for (int i = 1; i <= 1000; i++) {
      if ((i&ok) == ok) ask.push_back(i);
      else askk.push_back(i);
    }
    send(ask);
    if (fi) send(askk);
  };
  for (int i = 0; i < 10; i++) question(1<<i, 1);
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < i; j++) {
      question((1<<i)|(1<<j), 0);
    }
  }
  vector<int> ris = wait(), div;
  for (int i = 0; i < 20; i+=2) {
    if (ris[i] && ris[i+1]) {
      div.push_back(i/2);
    }
    else if (ris[i]) pos1 |= (1<<(i/2));
  }
  vector<vector<int>> check(10, vector<int> (10, 0));
  pos2 = pos1;
  int aus = 20;
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < i; j++) {
      if (ris[aus]) check[i][j] = check[j][i] = 1;
      aus++;
    }
  }
  if (div.size() == 0) return {pos1, pos1};
  pos1 |= 1<<div[0];
  int last = 1;
  for (int i = 0; i < div.size()-1; i++) {
    if (check[div[i]][div[i+1]]^last) {
      pos2 |= (1<<div[i+1]); last = 0;
    }
    else {
      pos1 |= (1<<div[i+1]); last = 1;
    }
  } 
  return {pos1, pos2};
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...