Submission #319859

# Submission time Handle Problem Language Result Execution time Memory
319859 2020-11-06T15:28:52 Z neki Cave (IOI13_cave) C++14
0 / 100
1205 ms 612 KB
#include "cave.h"
#include <bits/stdc++.h>
#define loop(i, a, b) for(long long i=a;i<b;i++)
#define pool(i, a, b) for(long long i=a-1;i>=b;i--)
#define fore(i, a) for(auto&& i:a)
#define fi first
#define se second
#define ps(a) push_back(a)
#define pb(a) pop_back(a)
#define sc scanf
#define vc vector
#define pa pair<ll, ll>
#define ll int
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(), a.end()
#define llmax LLONG_MAX/2
#define llmin -LLONG_MAX/2
using namespace std;
#define mn 5010
#define pa pair<ll, ll>
#define ld long double 
ll ans[mn], cor[mn];
void exploreCave(int n){
    ll arr[n], get[n];
    loop(i, 0, n){
        loop(j, 0, n) arr[j]=0 ,get[j]=1;
        loop(j, 0, i) arr[ans[j]]=cor[j], get[ans[j]]=0;
        ll br=(tryCombination(arr)!=i);
        vc<ll> act;
        loop(j, 0, n) if(get[j]) act.ps(j);
    
        ll l=0, r=(ll)act.size()-1;
        
        while(l<r){
            ll mid=(l+r)/2;
            fore(v, act) arr[v]=!br;
            loop(v, l, mid+1) arr[act[v]]=br;
            if(tryCombination(arr)==i xor br) r=mid;
            else l=mid+1;
        }
        ans[i]=l; cor[i]=!br;
    }
    ll fa[n], fc[n];
    loop(i, 0, n) fa[ans[i]]=i;
    loop(i, 0, n) fc[ans[i]]=cor[i];
    answer(fa, fc);
}

Compilation message

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:39:35: warning: suggest parentheses around comparison in operand of '^' [-Wparentheses]
   39 |             if(tryCombination(arr)==i xor br) r=mid;
      |                ~~~~~~~~~~~~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Incorrect 735 ms 612 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1205 ms 612 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 735 ms 612 KB Answer is wrong
2 Halted 0 ms 0 KB -