Submission #93060

# Submission time Handle Problem Language Result Execution time Memory
93060 2019-01-06T11:00:05 Z Bodo171 Cave (IOI13_cave) C++14
0 / 100
618 ms 908 KB
#include "cave.h"
#include <vector>
using namespace std;
vector<int> useless;
const int nmax=5005;
int ask[nmax],ans[nmax],perm[nmax];
int n,x,poz;
void incearca(int cate,int p)
{
    int ret=0;
    for(int p=12;p>=0;p--)
        if((ret+(1<<p))<=useless.size())
    {
        for(int j=0;j<n;j++)
            ask[j]=ans[j];
        for(int j=0;j<useless.size();j++)
            ask[useless[j]]=(1^p);
        for(int j=0;j<ret+(1<<p);j++)
            ask[useless[j]]^=1;
        x=tryCombination(ask);
        if(x==-1||x<cate) ret+=(1<<p);
    }
    poz=useless[ret-1];
    swap(useless[ret-1],useless.back());
    useless.pop_back();
    perm[poz]=cate;ans[poz]=p;
}
void exploreCave(int N) {
    /* ... */
    n=N;
    for(int i=0;i<N;i++)
        useless.push_back(i);
    for(int i=0;i<N;i++)
    {
        for(int j=0;j<N;j++)
            ask[j]=ans[j];
        x=tryCombination(ask);
        if(x!=-1&&x<i) incearca(i,1);
        else incearca(i,0);
    }
    answer(ans,perm);
}

Compilation message

cave.cpp: In function 'void incearca(int, int)':
cave.cpp:12:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if((ret+(1<<p))<=useless.size())
            ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
cave.cpp:16:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j=0;j<useless.size();j++)
                     ~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 434 ms 760 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 618 ms 908 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 6 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 6 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 434 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -