Submission #537429

# Submission time Handle Problem Language Result Execution time Memory
537429 2022-03-15T05:41:19 Z smth Cave (IOI13_cave) C++14
0 / 100
3 ms 724 KB
#include "cave.h"
#include<iostream>
#include<vector>
using namespace std;
int s[10000], doors[10000];
void exploreCave(int n) {

   vector<long long>v(n);
   int i,j;

   for(i=0;i<n;i++){s[i]=doors[i]=0; v[i]=i;}


   int sit;

       for(i=0;i<n;i++)
       {
           for(j=0;j<v.size();j++)s[v[j]]=0;

           if(tryCombination(s)==i)sit=0;
           else sit=1;

           int le=0, ri=v.size()-1, mid;

           while(le<=ri)
           {
               mid=(le+ri)/2;

               for(int k=0;k<v.size();k++)
               {
                   if(k<mid)s[v[k]]=sit;
                   else s[v[i]]=1-sit;
               }

               if(tryCombination(s)==i)ri=mid-1;
               else le=mid+1;
           }

           s[v[le]]=1-sit;
           doors[v[le]]=i;

           v.erase(v.begin()+le);
       }
       answer(s,doors);
}

Compilation message

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:18:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |            for(j=0;j<v.size();j++)s[v[j]]=0;
      |                    ~^~~~~~~~~
cave.cpp:29:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |                for(int k=0;k<v.size();k++)
      |                            ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 596 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 724 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 504 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 504 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 596 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -