Submission #1363592

#TimeUsernameProblemLanguageResultExecution timeMemory
1363592biserailievaGuessing Game (EGOI23_guessinggame)C++20
0 / 100
385 ms6220 KiB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int P, N;
    cin >> P >> N;

    if (P == 1)
    {
        int K = (N + 1) / 2;
        cout << K << endl;


        for (int i = 0; i < N - 1; i++)
        {
            int idx;
            cin >> idx;


            if (i < (N - 1) / 2)
            {
                cout << (i % K) + 1 << endl;
            }
            else
            {
                cout << (i % K) + 1 << endl;
            }
        }
    }
    else
    {
        vector<int> A(N);
        for (int i = 0; i < N; i++)
            cin >> A[i];


        map<int, vector<int>> pos;

        for (int i = 0; i < N; i++)
        {
            pos[A[i]].push_back(i);
        }

        vector<int> cand;

        for (auto &p : pos)
        {
            if (p.second.size() >= 2)
            {
                cand.push_back(p.second[0]);
                cand.push_back(p.second[1]);
                break;
            }
        }

        if (cand.size() < 2)
            cand = {0, 1};

        cout << cand[0] << " " << cand[1] << "\n";
    }

    return 0;
}
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...