Submission #511653

# Submission time Handle Problem Language Result Execution time Memory
511653 2022-01-16T03:32:59 Z KoD Tenis (COCI20_tenis) C++17
50 / 110
1000 ms 1580 KB
#include <bits/stdc++.h>

using std::vector;
using std::array;
using std::pair;
using std::tuple;

template <class F> struct RecLambda : private F {
    explicit RecLambda(F&& f) : F(std::forward<F>(f)) {}
    template <class... Args> decltype(auto) operator()(Args&&... args) const {
        return F::operator()(*this, std::forward<Args>(args)...);
    }
};

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int N;
    std::cin >> N;
    vector<array<int, 3>> rank(N);
    for (int i = 0; i < 3; ++i) {
        for (int j = 0; j < N; ++j) {
            int x;
            std::cin >> x;
            x -= 1;
            rank[x][i] = j;
        }
    }
    array<int, 3> play = {};
    vector<int> win(N);
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < i; ++j) {
            tuple tup(N, N, 3);
            for (int k = 0; k < 3; ++k) {
                tup = std::min(tup, tuple(std::min(rank[i][k], rank[j][k]), std::max(rank[i][k], rank[j][k]), k));
            }
            const int k = std::get<2>(tup);
            play[k] += 1;
            win[rank[i][k] < rank[j][k] ? i : j] += 1;
        }
    }
    for (int i = 0; i < 3; ++i) {
        std::cout << play[i] << " \n"[i + 1 == 3];
    }
    for (int j = 0; j < N; ++j) {
        std::cout << win[j] << " \n"[j + 1 == N];
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 2 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 2 ms 208 KB Output is correct
4 Correct 95 ms 404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 2 ms 208 KB Output is correct
4 Correct 95 ms 404 KB Output is correct
5 Execution timed out 1057 ms 1580 KB Time limit exceeded
6 Halted 0 ms 0 KB -