Submission #705482

#TimeUsernameProblemLanguageResultExecution timeMemory
705482YassineBenYounesCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
/*
ID: Yassine BenYounes
TASK: guard
LANG: C++
*/
#include<bits/stdc++.h>
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pbds tree<int, null_type, less<int>,rb_tree_tag, tree_order_statistics_node_update>
using namespace __gnu_pbds;
ll gcd(ll a , ll b) {return b ? gcd(b , a % b) : a ;} // greatest common divisor (PGCD)
ll lcm(ll a , ll b) {return (a * b) / gcd(a , b);} // least common multiple (PPCM)
int dx[8] = {1, 0, 0, -1, 1, 1, -1, -1};
int dy[8] = {0, 1, -1, 0, 1, -1, -1, 1};
#define endl "\n"
#define ss second
#define ff first
#define all(x) (x).begin() , (x).end()
#define pb push_back
#define vi vector<int>
#define vii vector<pair<int,int>>
#define vl vector<ll>
#define vll vector<pair<ll,ll>>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd  pair<double,double>
#define vdd  vector<pdd>
#define speed ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

const int mx = 2e5+9;
const int LOG = 25;
const ll inf = 1e15;
 
int pos[mx], door[mx], tr[mx];
 
int tryCombination(int pos[]);
 
void answer(int pos[], int door[]);
 
void exploreCave(int n){
    memset(pos, -1, sizeof pos);
    for(int i = 0; i < n;i++){
        // iterate on doors
        bool right = 0;
        for(int j = 0;j < n;j++){
            // iterate on switches
            if(pos[j] == -1)tr[j] = right;
            else tr[j] = pos[j]; 
        }
        int x = tryCombination(tr);
        if(x == i)right = 1;
        int l = 0, r = n-1;
        while(l < r){
            int md = (l+r)/2;
            for(int j = 0; j < n;j++){
                // iterate on switches
                if(j >= l && j <= md){
                    if(pos[j] == -1)tr[j] = right;
                    else tr[j] = pos[j]; 
                }
                else{
                    if(pos[j] == -1)tr[j] = !right;
                    else tr[j] = pos[j]; 
                }
            }
            int x = tryCombination(tr);
            if(x == i){
                l = md+1;
            }
            else{
                r = md;
            }
        }
        // switch for i-th door : l
        door[l] = i;
        pos[l] = right;
    }
    answer(pos, door);
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccmZTuZK.o: in function `main':
grader.c:(.text.startup+0x10): undefined reference to `exploreCave'
/usr/bin/ld: /tmp/cctwvhaL.o: in function `exploreCave(int)':
cave.cpp:(.text+0x11b): undefined reference to `tryCombination(int*)'
/usr/bin/ld: cave.cpp:(.text+0x197): undefined reference to `tryCombination(int*)'
/usr/bin/ld: cave.cpp:(.text+0x21b): undefined reference to `answer(int*, int*)'
collect2: error: ld returned 1 exit status