Submission #963668

#TimeUsernameProblemLanguageResultExecution timeMemory
963668Trisanu_DasAncient Machine 2 (JOI23_ancient2)C++17
37 / 100
81 ms1992 KiB
#include "ancient2.h"
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define FOR(i, x, y) for(ll i=x; i<y; i++)
#define FORNEG(i, x, y) for(ll i=x; i>y; i--)
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
 
 
std::string Solve(int N) {
  vector<int> a(502), b(502);
  a[500] = 500;
  b[500] = 500;
  a[501] = 501;
  b[501] = 501;
 
  string sus = "";
 
  FOR(i,0,500){
    FOR(j,0,500){
      if (j==i) a[j] = 500, b[j] = 501;
      else a[j] =j+1, b[j] = j+1;
    }
    ll ans = Query(502, a, b);
    if (ans==500) sus = sus + "0";
    else sus = sus + "1";
  }
 
  FOR(i,0,500){
    FOR(j,0,500){
      a[j] =j+1, b[j] = j+1;
      if (j==499) a[j] = 0, b[j] = 0;
      if (i==j){
        if (sus[j] == '0') b[j] = 501;
        else a[j] = 501;
      }
    }
    ll ans = Query(502, a, b);
    if (ans<500){
      if (sus[i] == '0') sus = sus + "0";
      else sus = sus + "1";
    }else{
      if (sus[i] == '0') sus = sus + "1";
      else sus = sus + "0";
    }
  }
  return sus;
}
#Verdict Execution timeMemoryGrader output
Fetching results...