Submission #76700

# Submission time Handle Problem Language Result Execution time Memory
76700 2018-09-16T03:09:59 Z liwi Cave (IOI13_cave) C++11
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;
#define println printf("\n");
#define readln(x) getline(cin,x);
#define pb push_back
#define endl "\n"
#define MOD 1000000007
#define mp make_pair

#define MAXN 5000

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef unordered_map<int,int> umii;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<int,pii> triple;
typedef int8_t byte;

int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}
ll fpow(ll  b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}

int num_switches,ans[MAXN],on[MAXN];

void exploreCave(int N){
    num_switches = N;
    for(int s=0; s<num_switches; s++){
        int temp[MAXN];
        for(int i=0; i<num_switches; i++)
            temp[i] = 1;
        int low = 0, high = num_switches-1, last = tryCombination(temp)>=s;
        
        while(low <= high){
            if(low == high){
                ans[s] = low;
                if(last) on[s] = temp[low];
                else on[s] = !temp[low];
                break;
            }
            int mid = (low+high)/2;
            memset(temp,0,sizeof temp);
            for(int i=low; i<=mid; i++)
                temp[i] = 1;
            if((tryCombination(temp)>=s) != last){
                high = mid;
                last = !last;
            }else{
                low = mid;
            }
        }
    }
}

void answer(int S[MAXN],int D[MAXN]){
    memcpy(S,on,sizeof on);
    memcpy(D,ans,sizeof ans);
}

int main(){
    
}

Compilation message

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:36:52: error: 'tryCombination' was not declared in this scope
         int low = 0, high = num_switches-1, last = tryCombination(temp)>=s;
                                                    ^~~~~~~~~~~~~~