| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1333353 | QuocSensei | Coins (IOI17_coins) | C++20 | 6 ms | 580 KiB |
#include <bits/stdc++.h>
#define ll long long
#define el cout << endl
#define BIT(n) (1ll << (n))
#define bit(mask, i) (((mask) >> (i)) & 1)
using namespace std;
const int maxn = 8;
namespace SUBTASK_1
{
namespace personA
{
vector<int> coin_flips(vector<int> b, int c)
{
vector<int> A;
if (c != b[0])
A.push_back(0);
else
A.push_back(63);
return A;
}
}
namespace personB
{
int find_coin(vector<int> b)
{
return b[0];
}
}
}
namespace SUBTASK_2
{
const int val[] = {0, 2, 1, 2, 1, 1, 2, 0};
namespace personA
{
vector<int> coin_flips(vector<int> b, int c)
{
int x = 0;
for (int i = 0; i < 3; i++)
x += b[i] * BIT(2 - i);
if (val[x] == c)
return {63};
for (int i = 0; i < maxn; i++)
if (__builtin_popcount(x ^ i) == 1 && val[i] == c)
{
// cout << "TRANS: " << (x ^ i), el;
return {2 - __lg(x ^ i)};
}
return {};
}
}
namespace personB
{
int find_coin(vector<int> b)
{
int x = 0;
for (int i = 0; i < 3; i++)
x += b[i] * BIT(2 - i);
return val[x];
}
}
}
vector<int> coin_flips(vector<int> b, int c)
{
return SUBTASK_2::personA::coin_flips(b, c);
}
int find_coin(vector<int> b)
{
return SUBTASK_2::personB::find_coin(b);
}Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
