Submission #120406

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1204062019-06-24 11:42:16nxteruCave (IOI13_cave)C++14
100 / 100
477 ms640 KiB
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
int n,ans[5005],k,s[5005];
void exploreCave(int N) {
n=N;
for(int i=0;i<n;i++)ans[i]=-1;
while(1){
vector<int>x;
for(int i=0;i<n;i++)if(ans[i]==-1)x.PB(i);
if(x.size()==0)break;
int p=tryCombination(s);
if(p==-1||p>k)p=1;
else p=0;
while(x.size()>1){
for(int i=0;i<x.size()/2;i++)s[x[i]]^=1;
int q=tryCombination(s);
if(q==-1||q>k)q=1;
else q=0;
vector<int>y;
if(p==q)for(int i=x.size()/2;i<x.size();i++)y.PB(x[i]);
else for(int i=0;i<x.size()/2;i++)y.PB(x[i]);
x.clear();
for(int i=0;i<y.size();i++)x.PB(y[i]);
p=q;
}
ans[x[0]]=k++;
if(p==0)s[x[0]]^=1;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:17:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int i=0;i<x.size()/2;i++)s[x[i]]^=1;
                ~^~~~~~~~~~~
cave.cpp:22:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if(p==q)for(int i=x.size()/2;i<x.size();i++)y.PB(x[i]);
                                 ~^~~~~~~~~
cave.cpp:23:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    else for(int i=0;i<x.size()/2;i++)y.PB(x[i]);
                     ~^~~~~~~~~~~
cave.cpp:25:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int i=0;i<y.size();i++)x.PB(y[i]);
                ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...