#include <cstdio>
#include <cstring>
bool haha[1005];
int Num;
void Init(int N)
{
memset(haha, 0, sizeof(haha));
Num = N;
}
int MakeTurn(int M)
{
int tcnt = 0, fcnt = 0, maxidx = 0, maxv = -987654321;
for(int i = M; i < Num; ++i) {
if(haha[i])
tcnt++;
else
fcnt++;
if(maxv < fcnt - tcnt) {
maxv = fcnt - tcnt;
maxidx = i;
}
}
for(int i = M; i <= maxidx; ++i)
haha[i] = !haha[i];
return maxidx + 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1128 KB |
Output is correct |
2 |
Incorrect |
0 ms |
1128 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |