# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
29865 | dereotu | Robots (IOI13_robots) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "cave.h"
#include <bits/stdc++.h>
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define forr(i,A,B) for(int i=A;i<B;++i)
#define space ' '
#define endl '\n'
#define LL long long
using namespace std;
void exploreCave(int N) {
int a[N]={0},ans[N],done[N];
memset(ans,-1,sizeof ans);
memset(done,-1,sizeof done);
int last=tryCombination(a);
forr(j,0,N){
forr(i,0,N){
if(done[i]!=-1) continue;
a[i]=1;
int res=tryCombination(a);
if(res==-1){
a[i]=0;
int wtf=tryCombination(a);
ans[i]=wtf;
a[i]=1;
done[i]=1;
continue;
}
if(res!=last){
if(last>res){
a[i]=0;
ans[i]=res;
done[i]=1;
}
else{
ans[i]=last;
a[i]=1;
done[i]=1;
last=res;
}
}
else{
a[i]=0;
}
}
}
forr(i,0,N){
assert(ans[i]!=-1);
}
answer(a,ans);
}