Submission #1370091

#TimeUsernameProblemLanguageResultExecution timeMemory
1370091Sam_a17Magic Show (APIO24_show)C++20
5 / 100
3 ms1092 KiB
#include "Alice.h"
#include <bits/stdc++.h>
#include <vector>
using namespace std;

// you may define some global variables, but it does not work if you try to transfer any information from function
// Alice() to function Bob() through these variables. you had better not use the same global variables in function
// Alice() and in function Bob().

vector<pair<int, int>> Alice()
{
    long long x = setN(5000);

    vector<pair<int, int>> ans;
    for (long long i = 1; i <= 5000; i++)
    {
        if (i == x)
        {
            continue;
        }
        ans.push_back({min(i, x), max(i, x)});
    }

    return ans;
}
#include "Bob.h"
#include <bits/stdc++.h>
#include <vector>
using namespace std;

// you may define some global variables, but it does not work if you try to transfer any information from function
// Alice() to function Bob() through these variables. you had better not use the same global variables in function
// Alice() and in function Bob().

long long Bob(std::vector<std::pair<int, int>> V)
{
    map<int, int> mp;
    int ans = 0;
    for (int i = 0; i < V.size(); ++i)
    {
        mp[V[i].first]++;
        mp[V[i].second]++;

        if (mp[V[i].first] > 1)
        {
            ans = V[i].first;
        }
        else if (mp[V[i].second] > 1)
        {
            ans = V[i].second;
        }
    }

    return ans; // change this into your code
}
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...