Submission #359954

# Submission time Handle Problem Language Result Execution time Memory
359954 2021-01-27T11:18:30 Z MrRobot_28 Tenis (COCI20_tenis) C++17
50 / 110
1000 ms 2156 KB
#include<bits/stdc++.h>
using namespace std;
signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    int a[3][n];
    int pos[3][n];
    vector <int> cnt(3, 0);
    for(int i = 0; i < 3; i++)
    {
        for(int j = 0;j < n; j++)
        {
            cin >> a[i][j];
            a[i][j]--;
            pos[i][a[i][j]] = j;
        }
    }
    vector <int> cnt1(n, 0);
    for(int i = 0; i < n; i++)
    {
        for(int j = i + 1; j < n; j++)
        {
            vector <pair <pair <int, int>, int> > mass;
            for(int t = 0; t < 3; t++)
            {
                int f1 = min(pos[t][i], pos[t][j]);
                int f2 = max(pos[t][i], pos[t][j]);
                mass.push_back({{f1, f2}, t});
            }
            sort(mass.begin(), mass.end());
            int ind = mass[0].second;
            if(pos[ind][i] < pos[ind][j])
            {
                cnt1[i]++;
            }
            else
            {
                cnt1[j]++;
            }
            cnt[ind]++;
        }
    }
    for(int i = 0; i < 3; i++)
    {
        cout << cnt[i] << " ";
    }
    cout << "\n";
    for(int i = 0; i < n; i++)
    {
        cout << cnt1[i] << " ";
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 7 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 7 ms 364 KB Output is correct
4 Correct 566 ms 620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 7 ms 364 KB Output is correct
4 Correct 566 ms 620 KB Output is correct
5 Execution timed out 1088 ms 2156 KB Time limit exceeded
6 Halted 0 ms 0 KB -