QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#215135#6550. Elimination Raceucup-team1716#WA 0ms3760kbC++201.3kb2023-10-15 03:36:472023-10-15 03:36:48

Judging History

This is the latest submission verdict.

  • [2023-10-15 03:36:48]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3760kb
  • [2023-10-15 03:36:47]
  • Submitted

answer

#include <bits/stdc++.h>
#define ll long long
#define pb push_back

using namespace std;

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

    int n;
    cin >> n;

    vector<vector<int>> a(n-1, vector<int>(n));
    for(int i=0; i<n-1; i++)
    {
        for(int j=0; j<n; j++) cin >> a[i][j];
    }

    for(int i=0; i<n; i++)
    {
        vector<bool> elim(n, false);

        vector<pair<int, int>> to_elim;
        for(int j=0; j<n-1; j++)
        {
            int cnt = 0;
            for(int k=n-1; k>=0; k--)
            {
                cnt++;
                if(a[j][k] == i+1) break;
            }
            to_elim.pb({cnt, j+1});
        }

        sort(to_elim.begin(), to_elim.end());
        for(int j=0; j<n-1; j++)
        {
            for(int k=n-1; k>=0; k--)
            {
                if(elim[a[to_elim[j].second-1][k]-1]) continue;
                else
                {
                    elim[a[to_elim[j].second-1][k]-1] = true;
                    break;
                }
            }
        }

        if(elim[i]) cout << "No\n";
        else
        {
            cout << "Yes\n";
            for(int j=0; j<n-1; j++) cout << to_elim[j].second << " ";
            cout << "\n";
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3632kb

input:

4
1 2 3 4
2 1 3 4
4 3 1 2

output:

Yes
3 2 1 
No
No
No

result:

ok n=4, yes=1, no=3

Test #2:

score: 0
Accepted
time: 0ms
memory: 3496kb

input:

3
2 1 3
2 1 3

output:

No
Yes
1 2 
No

result:

ok n=3, yes=1, no=2

Test #3:

score: 0
Accepted
time: 0ms
memory: 3524kb

input:

2
1 2

output:

Yes
1 
No

result:

ok n=2, yes=1, no=1

Test #4:

score: 0
Accepted
time: 0ms
memory: 3492kb

input:

2
2 1

output:

No
Yes
1 

result:

ok n=2, yes=1, no=1

Test #5:

score: 0
Accepted
time: 0ms
memory: 3760kb

input:

11
4 3 6 1 11 10 5 7 8 9 2
11 6 5 1 10 3 8 2 7 9 4
5 9 2 11 3 4 1 10 8 6 7
9 11 8 3 5 4 1 6 7 10 2
3 9 7 6 5 10 1 4 11 8 2
8 2 4 1 5 9 3 7 6 10 11
3 8 2 9 1 4 5 10 11 6 7
10 11 4 1 7 5 2 6 8 9 3
10 6 9 3 2 1 4 8 11 7 5
8 11 9 1 4 10 2 5 3 7 6

output:

Yes
3 4 5 9 7 1 2 6 8 10 
No
No
No
No
No
No
Yes
5 1 3 8 9 2 4 7 6 10 
Yes
1 2 8 6 7 9 10 3 5 4 
Yes
4 6 3 7 1 5 10 2 8 9 
No

result:

ok n=11, yes=4, no=7

Test #6:

score: -100
Wrong Answer
time: 0ms
memory: 3580kb

input:

11
6 7 8 9 3 4 1 11 5 10 2
7 10 6 3 1 2 5 11 4 9 8
4 3 9 1 10 2 5 7 6 8 11
10 4 2 11 8 1 5 7 9 6 3
11 9 4 6 8 2 1 7 3 5 10
9 10 2 7 4 11 6 1 3 8 5
11 8 4 9 7 1 2 10 5 3 6
5 7 9 10 1 8 4 2 6 11 3
4 2 9 7 10 1 6 8 3 5 11
2 7 6 10 5 11 1 8 4 9 3

output:

No
No
No
Yes
2 10 8 1 6 5 7 4 3 9 
No
No
Yes
3 4 5 7 6 9 1 8 10 2 
No
Yes
2 10 4 1 7 3 8 9 5 6 
No
No

result:

wrong answer Jury has the answer but participant has not