Submission #71847

# Submission time Handle Problem Language Result Execution time Memory
71847 2018-08-25T16:59:47 Z yusufake Cave (IOI13_cave) C++
13 / 100
819 ms 640 KB
#include<bits/stdc++.h>
using namespace std;
#include "cave.h"

int A[5003],T[5003];
vector < int > v;
void exploreCave(int n) {
    /* ... */
    int i,j,l,m,r;
    v.clear();
    for(i=0;i<n;i++) v.push_back(i);
    for(i=0;i<n;i++){
        l = 0;
        r = v.size()-1;
        if(tryCombination(T) == i){
            for(; l<r ;){
                m = l+r >> 1;
                for(j=0;j<=m;j++) T[ v[j] ] = 1;
                if(tryCombination(T) > i) r = m;
                else l = m+1;
                for(j=0;j<=m;j++) T[ v[j] ] = 0;
            }
            j = v[l];
            A[j] = i;
            T[j] = 1;
        }
        else{
            for(; l<r ;){
                m = l+r >> 1;
                for(j=0;j<=m;j++) T[ v[j] ] = 1;
                if(tryCombination(T) == i) r = m;
                else l = m+1;
                for(j=0;j<=m;j++) T[ v[j] ] = 0;
            }
            j = v[l];
            A[j] = i;
            T[j] = 0;
        }
        v.erase(v.begin() + l);
    }
    answer(T,A);
}

Compilation message

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:17:22: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
                 m = l+r >> 1;
                     ~^~
cave.cpp:29:22: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
                 m = l+r >> 1;
                     ~^~
# Verdict Execution time Memory Grader output
1 Incorrect 183 ms 516 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 296 ms 548 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 432 ms 512 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 287 ms 540 KB Output is correct
7 Correct 819 ms 544 KB Output is correct
8 Correct 529 ms 640 KB Output is correct
9 Correct 538 ms 544 KB Output is correct
10 Correct 484 ms 552 KB Output is correct
11 Correct 738 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 396 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 512 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 452 KB Output is correct
6 Correct 6 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 460 KB Output is correct
9 Correct 5 ms 512 KB Output is correct
10 Incorrect 5 ms 512 KB Answer is wrong
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 396 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 512 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 452 KB Output is correct
6 Correct 6 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 460 KB Output is correct
9 Correct 5 ms 512 KB Output is correct
10 Incorrect 5 ms 512 KB Answer is wrong
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 183 ms 516 KB Answer is wrong
2 Halted 0 ms 0 KB -