Submission #301341

# Submission time Handle Problem Language Result Execution time Memory
301341 2020-09-17T21:03:16 Z peti1234 Cave (IOI13_cave) C++17
0 / 100
2 ms 640 KB
#include <bits/stdc++.h>
#include "cave.h"
using namespace std;
const int c=5002;
int par[c], t[c];
bool v[c];
int f(int a, int b) {
    for (int i=a; i<b; i++) if (!v[i]) t[i]=1-t[i];
}
bool jo(int p) {
    int x=tryCombination(t);
    if (x==-1) x=1e9;
    return x>p;
}
void exploreCave(int n) {
    for (int i=0; i<n; i++) {
        if (!jo(i)) f(0, n);
        int lo=0, hi=n;
        while(hi-lo>1) {
            int mid=(hi+lo)/2;
            f(mid, hi);
            if (jo(i)) hi=mid;
            else lo=mid, f(mid, hi);
        }
        par[lo]=i, v[lo]=1;
    }
    answer(t, par);
}

Compilation message

cave.cpp: In function 'int f(int, int)':
cave.cpp:9:1: warning: no return statement in function returning non-void [-Wreturn-type]
    9 | }
      | ^
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 640 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 640 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 640 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -