Submission #366501

# Submission time Handle Problem Language Result Execution time Memory
366501 2021-02-14T09:48:19 Z NONAME Tenis (COCI20_tenis) C++14
0 / 110
5 ms 3692 KB
#include <bits/stdc++.h>
#define in(x) freopen(x, "r", stdin)
#define out(x) freopen(x, "w", stdout)
using namespace std;

const int man = (int)(3e3 + 500);

int n;
int a[man], ans[man], court[man];
array <int, 3> best[man][man];
bool win[man][man];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    #ifdef _LOCAL
        in("inE.txt");
        out("outE.txt");
    #endif

    cin >> n;
    for (int tp = 0; tp < 3; ++tp) {
        for (int i = 0; i < n; ++i) {
            cin >> a[i];
            --a[i];
        }
        for (int i = 0; i < n; ++i) {
            for (int j = i + 1; j < n; ++j) {
                int x = a[i], y = a[j];
                if (win[x][y] == true) {
                    if (i < best[x][y][0]) {
                        best[x][y] = {i, j, tp};
                    } else if (j < best[x][y][1]) {
                        best[x][y] = {i, j, tp};
                    }
                } else {
                    win[x][y] = true;
                    best[x][y] = {i, j, tp};
                }
            }
        }
    }

    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
            assert((win[i][j] || win[j][i]) == true);
            if ((win[i][j] == true) && (win[j][i] == true)) {
                if (best[i][j][0] < best[j][i][0]) {
                    ++court[best[i][j][2]];
                    ++ans[i];
                } else if (best[j][i][0] < best[i][j][0]) {
                    ++court[best[j][i][2]];
                    ++ans[j];
                } else if (best[i][j][1] < best[j][i][1]) {
                    ++court[best[i][j][2]];
                    ++ans[i];
                } else if (best[j][i][1] < best[i][j][1]) {
                    ++court[best[j][i][2]];
                    ++ans[j];
                } else if (best[i][j][2] < best[j][i][2]) {
                    ++court[best[i][j][2]];
                    ++ans[i];
                } else {
                    ++court[best[j][i][2]];
                    ++ans[j];
                }
            } else if (win[i][j] == true) {
                ++court[best[i][j][2]];
                ++ans[i];
            } else {
                ++court[best[j][i][2]];
                ++ans[j];
            }
        }
    }

    for (int i = 0; i < 3; ++i) {
        cout << court[i] << " ";
    }
    cout << "\n";
    for (int i = 0; i < n; ++i) {
        cout << ans[i] << " ";
    }
    cout << "\n";

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Partially correct 1 ms 512 KB Partially correct
3 Incorrect 5 ms 3692 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Partially correct 1 ms 512 KB Partially correct
3 Incorrect 5 ms 3692 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Partially correct 1 ms 512 KB Partially correct
3 Incorrect 5 ms 3692 KB Output isn't correct