This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |