# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28454 | ㅁㄴㅇㄹ (#68) | Bulb Game (FXCUP2_bulb) | C++98 | 0 ms | 2036 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 "bulb.h"
#include <bits/stdc++.h>
using namespace std;
int n;
int a[1005];
void Init(int N) {
n=N;
for(int i=1;i<=n;i++) a[i]=0;
}
int MakeTurn(int M) {
a[M]=1;
int l=-999999,r=-999999;
for(int i=M+1;i<=n;i++){
if(!a[i]){
r=i;
break;
}
}
for(int i=M-1;i;i--){
if(!a[i]){
l=i;
break;
}
}
if(l==-999999) return r;
if(r==-999999) return l;
int res=(r-M<M-l?l:r);
a[res]=1;
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |