Submission #1066140

#TimeUsernameProblemLanguageResultExecution timeMemory
1066140beaconmcHow to Avoid Disqualification in 75 Easy Steps (CEOI23_avoid)C++17
10.00 / 100
1 ms344 KiB
#include "avoid.h"
#include <vector>
#include <bits/stdc++.h>
 
typedef int ll;
#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(ll i=x; i>y; i--)
 
using namespace std;


map<vector<ll>, ll> pos;

std::pair<int, int> scout(int R, int H) {
    FOR(i,0,10){
        vector<ll> temp;
        FOR(j,1,1001){
            if (j&(1<<i)) temp.push_back(j);
        }
        send(temp);
        temp.clear();

        FOR(j,1,1001){
            if (!(j&(1<<i))) temp.push_back(j);
        }
        send(temp);
    }

    ll cnt = 20;
    FOR(i,0,10){
        FOR(j,i+1,10){
            vector<ll> temp;
            FOR(k,1,1001){
                if ((k & (1<<i)) && (k&(1<<j))){
                    temp.push_back(k);
                }
            }
            send(temp);
            temp.clear();
            pos[{i,j}] = cnt++;
        }
    }
    vector<ll>sus =  wait();

    ll xored = 0;
    ll anded = 0;
    bool done = false;

    ll one = 0;

    FOR(i,0,10){
        xored += (1-(sus[2*i] ^ sus[2*i+1])) * (1<<i);
        anded += (sus[2*i] * (1<<i));

        if (sus[2*i]==1 && sus[2*i+1]==1 && !done){
            one += (1<<i);
            FOR(j,0,10){
                if (i==j) continue;
                ll a = i;
                ll b = j;
                if (a>b) swap(a,b);
                if (sus[pos[{a,b}]]) one += (1<<j);
            }
            done = 1;
        }
    }
    if (!done){
        return {anded, anded};
    }

    return {one, (xored^one)};
}





#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...