CSES - Datatähti 2025 alku - Results
Submission details
Task:Kortit II
Sender:vulpesomnia
Submission time:2024-10-30 11:57:30 +0200
Language:C++ (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
#40
#50
Test results
testverdicttimegroup
#10.00 s1, 2, 3, 4, 5details
#20.00 s2, 3, 4, 5details
#30.01 s3, 4, 5details
#40.01 s4, 5details
#50.11 s5details
#60.46 s5details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:38:9: warning: unused variable 'n2' [-Wunused-variable]
   38 |     int n2 = n-d;
      |         ^~

Code

#include <bits/stdc++.h>

using namespace std;

string test(vector<int> l1, vector<int> l2, int a, int b, int n) {
  int p1 = 0;
  int p2 = 0;
  for (int i = 0; i < n; i++) {
    if (l1[i] > l2[i]) {
      p1++;
    } else if (l1[i] < l2[i]) {
      p2++;
    }
  }
  if (p1 == a && p2 == b) {
    return "true";
  } else {
    return "false";
  }
}

int main() {
  int t;
  vector<vector<int>> g;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int n, a, b;
    cin >> n >> a >> b;
    g.push_back({n, a, b});
  }

  for (int i = 0; i < (int)g.size(); i++) {
    int n = g[i][0];
    int a = g[i][1];
    int b = g[i][2];
    int d = n-(a+b);

    int n2 = n-d;


    if (a+b <= n && (abs(a-b) != a+b || a+b == 0)) {
      cout << "YES" << "\n";
 
      vector<int> p1 = {};
      vector<int> p2 = {};

      //Ensin tasapelit:
      for (int j = 1; j <= d; j++) {
        p1.push_back(j);
        p2.push_back(j);
      }
      if (n > d) {
        for (int j = n; j > n-b; j--) {
          p1.push_back(j);
          p2.push_back(j-a);
        }
        for (int j = n; j > n-a; j--) {
          p2.push_back(j);
          p1.push_back(j-b);
        }
      }

      for (int j = 0; j < (int)p2.size(); j++) {
        cout << p2[j] << " ";
      }
      cout << "\n";
      for (int j = 0; j < (int)p1.size(); j++) {
        cout << p1[j] << " ";
      }
      //cout << test(p2, p1, a, b, n);
      cout << "\n";
      continue;
    }
    cout << "NO" << "\n";
  }
}
/*
7 8 2
3 9 2
0 1 2
3 2 0
1 0 0
5 0 0
7 0 2
4 2 1
8 2 3
1 6 3
11 4 2
9 5 9
5 6 4
2 3 4
7 4 0
4 9 0
0 0 0
3 0 1
0 4 0
2 4 1
*/

Test details

Test 1

Group: 1, 2, 3, 4, 5

Verdict:

input
54
4 4 0
3 1 3
3 2 2
4 0 4
...

correct output
0
0
0
0
0
...

user output
NO
NO
NO
NO
NO
...

Test 2

Group: 2, 3, 4, 5

Verdict:

input
284
6 1 0
5 0 2
7 1 5
7 7 5
...

correct output
0
0
35280
0
36720
...

user output
NO
NO
YES
1 6 5 4 3 2 7 
1 7 6 5 4 3 2 
...

Test 3

Group: 3, 4, 5

Verdict:

input
841
19 3 12
19 19 13
19 7 13
20 11 15
...

correct output
40291066
0
0
0
0
...

user output
YES
1 2 3 4 16 15 14 13 12 11 10 9...

Test 4

Group: 4, 5

Verdict:

input
1000
15 12 6
7 1 6
44 4 26
6 6 5
...

correct output
0
5040
494558320
0
340694548
...

user output
NO
YES
6 5 4 3 2 1 7 
7 6 5 4 3 2 1 
YES
...

Test 5

Group: 5

Verdict:

input
1000
892 638 599
966 429 655
1353 576 1140
1403 381 910
...

correct output
0
0
0
249098285
0
...

user output
NO
NO
NO
YES
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

Test 6

Group: 5

Verdict:

input
1000
2000 1107 508
2000 1372 249
2000 588 65
2000 1739 78
...

correct output
750840601
678722180
744501884
159164549
868115056
...

user output
YES
1 2 3 4 5 6 7 8 9 10 11 12 13 ...