제출 #1333360

#제출 시각아이디문제언어결과실행 시간메모리
1333360QuocSenseiCoins (IOI17_coins)C++20
25 / 100
5 ms768 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];
        }
    }
}
namespace SUBTASK_3
{
    namespace personA
    {
        vector<int> coin_flips(vector<int> b, int c)
        {
            vector<int> A;
            for (int i = 0; i < maxn * maxn; i++)
                if ((i != c && b[i]) || (i == c && !b[i]))
                    A.push_back(i);
            if (A.empty())
            {
                A.push_back(c);
                A.push_back(c);
            }
            return A;
        }
    }

    namespace personB
    {
        int find_coin(vector<int> b)
        {
            for (int i = 0; i < maxn * maxn; i++)
                if (b[i])
                    return i;
            return -1;
        }
    }
}
namespace SUBTASK_4
{
    namespace personA
    {
        vector<int> coin_flips(vector<int> b, int c)
        {
            vector<int> A;
            for (int i = 0; i < 6; i++)
                if (b[i] ^ bit(c, 5 - i))
                    A.push_back(i);
            if (A.empty())
            {
                A.push_back(63);
                A.push_back(63);
            }
            return A;
        }
    }

    namespace personB
    {
        int find_coin(vector<int> b)
        {
            int ans = 0;
            for (int i = 0; i < 6; i++)
                ans += b[i] * BIT(5 - i);
            return ans;
        }
    }
}

vector<int> coin_flips(vector<int> b, int c)
{
    return SUBTASK_4::personA::coin_flips(b, c);
}
int find_coin(vector<int> b)
{
    return SUBTASK_4::personB::find_coin(b);
}

컴파일 시 표준 에러 (stderr) 메시지

grader.cpp: In function 'void shuffle(std::vector<int>&)':
grader.cpp:88:23: warning: 'void std::random_shuffle(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<int*, vector<int> >]' is deprecated: use 'std::shuffle' instead [-Wdeprecated-declarations]
   88 |         random_shuffle(v.begin(), v.end());
      |         ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:61,
                 from grader.cpp:5:
/usr/include/c++/13/bits/stl_algo.h:4581:5: note: declared here
 4581 |     random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...