Submission #1083427

# Submission time Handle Problem Language Result Execution time Memory
1083427 2024-09-03T05:57:19 Z Namkhing Magic Show (APIO24_show) C++17
0 / 100
2 ms 816 KB
#include "Alice.h"
#include <bits/stdc++.h>
using namespace std;


vector<pair<int, int>> Alice() {
    int n = 5000;
    long long x = setN(n); x--;
    int p = x / n;
    int q = x % n;
    int r = (p + q) % n;
    p++, q++, r++;
    
    vector<pair<int, int>> edges;
    
    for (int i = 1; i <= 1666; i++) {
        if (i == p || i == q || i == r) continue;
        edges.push_back({p, i});
    }
    for (int i = 1667; i <= 3333; i++) {
        if (i == p || i == q || i == r) continue;
        edges.push_back({q, i});
    }
    for (int i = 3334; i <= 5000; i++) {
        if (i == p || i == q || i == r) continue;
        edges.push_back({r, i});
    }
    if (edges.size() < 4999) edges.push_back({p, q});
    if (edges.size() < 4999) edges.push_back({q, r});
    return edges;
}
#include "Bob.h"
#include <bits/stdc++.h>
using namespace std;


long long Bob(vector<pair<int, int>> V) {
    int n = 5000;
    vector<int> cnt(n + 1);

    for (auto [u, v] : V) {
        cnt[u]++, cnt[v]++;
    }

    int p = 0;
    int q = 0;
    int r = 0;

    for (int i = 1; i <= 1666; i++) {
        if (cnt[i] > 5) p = i;
    }
    for (int i = 1667; i <= 3333; i++) {
        if (cnt[i] > 5) q = i;
    }
    for (int i = 3334; i <= 5000; i++) {
        if (cnt[i] > 5) r = i;
    }
    p--, q--, r--;

    if (p == -1) {
        p = (r - q + n) % n;
    }
    else if (q == -1) {
        q = (r - p + n) % n;
    }
    else if (r == -1) {
        r = (p + q) % n;
    }

    long long x = p * n + q; x++;

    return x;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 816 KB Correct.
2 Incorrect 2 ms 816 KB Incorrect answer.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 816 KB Correct.
2 Incorrect 2 ms 816 KB Incorrect answer.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 816 KB Correct.
2 Incorrect 2 ms 816 KB Incorrect answer.
3 Halted 0 ms 0 KB -