# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
979289 | fv3 | Counting Mushrooms (IOI20_mushrooms) | C++14 | 67 ms | 504 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "mushrooms.h"
using namespace std;
typedef long long ll;
int count_mushrooms(int N)
{
vector<int> index(N);
for (int i = 0; i < N; i++)
index[i] = i;
//mt19937 mt(time(NULL));
//shuffle(index.begin() + 1, index.end(), mt);
int ans = 1;
for (int i = 1; i < N - 3; i += 4)
{
int a = index[i], b = index[i+1], c = index[i+2], d = index[i+3];
int res = use_machine( { a, b, 0, c, d } );
if (res == 0)
{
ans += 4;
}
else if (res == 1)
{
int t = use_machine({0, a, c, b, d});
if (t == 1 || t == 2) ans += 3;
else ans += 2;
}
else if (res == 2)
{
int t = use_machine({c, a, 0, d, b});
if (t == 1) ans += 3;
else if (t == 4) ans += 2;
else if (t == 3) ans++;
}
else if (res == 3)
{
int t = use_machine({a, b, c, d});
if (t == 3) ans += 2;
else if (t == 1) ans++;
}
else
{
ans += 2;
}
}
for (int i = 0; i < (N - 1) % 4; i++)
{
if (!use_machine({0, index[N - 1 - i]})) ans++;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |