Submission #308096

# Submission time Handle Problem Language Result Execution time Memory
308096 2020-09-30T03:30:17 Z daniel920712 Cave (IOI13_cave) C++14
0 / 100
2 ms 512 KB
#include "cave.h"
#include <set>
#include <vector>
using namespace std;
set < int > all;
vector < int > how;
int have[5005]={0};
int ans[5005];
void F(int l,int r,int here)
{
    int t,x,y,t2,i;
    if(l==r)
    {
        have[how[l]]=0;
        t=tryCombination(have);
        if(t==here-1) have[how[l]]=1;
        else have[how[l]]=0;
        ans[how[l]]=here;
        return;
    }
    x=(l+r)/2;
    for(i=l;i<=r;i++) have[how[i]]=0;
    t=tryCombination(have);
    for(i=l;i<=x;i++) have[how[i]]=1;
    t2=tryCombination(have);

    if(t==here-1&&t2!=here-1||t!=here-1&&t==here-1) F(l,x,here);
    else F(x+1,r,here);

}
void exploreCave(int N)
{
    int i;
    for(i=0;i<N;i++)
    {
        how.clear();
        for(auto j:all) how.push_back(j);
        F(0,N-i-1,i);

    }
    answer(have,ans);
}

Compilation message

cave.cpp: In function 'void F(int, int, int)':
cave.cpp:27:17: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   27 |     if(t==here-1&&t2!=here-1||t!=here-1&&t==here-1) F(l,x,here);
      |        ~~~~~~~~~^~~~~~~~~~~~
cave.cpp:11:13: warning: unused variable 'y' [-Wunused-variable]
   11 |     int t,x,y,t2,i;
      |             ^
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -