Submission #1164829

#TimeUsernameProblemLanguageResultExecution timeMemory
1164829JahonaliXMagic Show (APIO24_show)C++20
0 / 100
2 ms624 KiB
#include <bits/stdc++.h>
#include "Alice.h"

using namespace std;

vector<pair<int, int>> Alice() {
    long long x = setN(5000);
    vector<pair<int, int>> r;
    x--;
    if (x % 5000 == x / 5000) {
        for (int i = 1; i <= 5000; ++i) {
            if (i == x % 5000 + 1) continue;
            r.emplace_back(x % 5000 + 1, i);
        }
        return r;
    }
    r.emplace_back(x % 5000 + 1, x / 5000 + 1);
    for (int i = 1; i <= 5000; ++i) {
        if (i == x % 5000 + 1 || i == x / 5000 + 1) continue;
        if (r.size() < 2499) r.emplace_back(i, x % 5000 + 1);
        else r.emplace_back(i, x / 5000 + 1);
    }
    return r;
}
#include <bits/stdc++.h>
#include "Bob.h"

using namespace std;

long long Bob(vector<pair<int, int>> V) {
    map<int, int> mp;
    for (auto &[x, y] : V) {
        mp[x]++;
        mp[y]++;
    }
    vector<int> a;
    for (auto &[x, y] : mp) if (y > 1) a.emplace_back(x);
    if (a.size() == 1) return a[0] * 5000 - 5000 + a[0];
    for (auto [x, y] : V) {
        if (x == a[0] && y == a[1] || x == a[1] && y == a[0]) return y * 5000 - 5000 + x;
    }
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...