CSES - Datatähti 2025 alku - Results
Submission details
Task:Kortit I
Sender:Chenran
Submission time:2024-11-03 18:26:45 +0200
Language:C++ (C++11)
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:18:13: error: return-statement with no value, in function returning 'int' [-fpermissive]
   18 |             return;
      |             ^~~~~~
input/code.cpp:14:13: warning: unused variable 'ties' [-Wunused-variable]
   14 |         int ties = n - wins;
      |             ^~~~

Code

#include <iostream>
using namespace std;

int main() {
    int t;
    cin >> t;

    int n, a, b;

    while (t--) {
        cin >> n >> a >> b;

        int wins = a + b;
        int ties = n - wins;

        if ((a + b > n) || (a == 0 && b != 0) || (b == 0 && a != 0)) {
            cout << "NO\n";
            return;
        }

        cout << "YES\n";

        for (int i = b + 1; i <= wins; i++) {
            cout << i << " ";
        }

        for (int i = 1; i <= b; i++) {
            cout << i << " ";
        }

        for (int i = wins + 1; i <= n; i++) {
            cout << i << " ";
        }

        cout << "\n";

        for (int i = 1; i <= n; i++) {
            cout << i << " ";
        }

        cout << "\n";
    }

    return 0;
}