CSES - Datatähti 2024 loppu - Results
Submission details
Task:Sulut
Sender:perusjuntti
Submission time:2024-01-20 13:33:11 +0200
Language:C++ (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#1ACCEPTED0.00 s1, 2, 3details
#2ACCEPTED0.00 s1, 2, 3details
#30.00 s1, 2, 3details
#4ACCEPTED0.00 s1, 2, 3details
#5ACCEPTED0.00 s1, 2, 3details
#60.00 s1, 2, 3details
#7ACCEPTED0.00 s1, 2, 3details
#8ACCEPTED0.00 s1, 2, 3details
#90.00 s1, 2, 3details
#100.00 s1, 2, 3details
#11ACCEPTED0.00 s1, 2, 3details
#120.00 s1, 2, 3details
#13ACCEPTED0.00 s1, 2, 3details
#140.00 s1, 2, 3details
#150.00 s1, 2, 3details
#160.00 s1, 2, 3details
#17ACCEPTED0.00 s1, 2, 3details
#18ACCEPTED0.00 s1, 2, 3details
#19ACCEPTED0.00 s1, 2, 3details
#20ACCEPTED0.00 s2, 3details
#210.00 s2, 3details
#220.00 s2, 3details
#230.00 s2, 3details
#240.00 s2, 3details
#25ACCEPTED0.01 s3details
#260.01 s3details
#270.01 s3details
#280.01 s3details
#290.00 s3details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:19:13: warning: unused variable 'i' [-Wunused-variable]
   19 |         int i = 0;
      |             ^

Code

#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
    int n, k;
    cin >> n >> k;

    if (n & 1 || k > n / 2 - 1)
        cout << "IMPOSSIBLE\n";
    else {
        string s1 = "", s2 = "";
        for (int i = 0; i < n / 2; ++i)
            s1 += '(';
        for (int i = 0; i < n / 2; ++i)
            s1 += ')';
        
        s2 = s1;
        int i = 0;
        for (int i = 1; i < n / 2-1 && k; i += 2) {
            s2[i] = ')';
            --k;
        }
        for (int i = n / 2+1; i < n && k; i += 2) {
            s2[i] = '(';
            --k;
        }

        cout << s1 << '\n' << s2 << '\n';
    }


}

Test details

Test 1

Group: 1, 2, 3

Verdict: ACCEPTED

input
2 0

correct output
()
()

user output
()
()

Test 2

Group: 1, 2, 3

Verdict: ACCEPTED

input
4 0

correct output
()()
()()

user output
(())
(())

Test 3

Group: 1, 2, 3

Verdict:

input
4 2

correct output
()()
(())

user output
IMPOSSIBLE

Test 4

Group: 1, 2, 3

Verdict: ACCEPTED

input
6 0

correct output
()()()
()()()

user output
((()))
((()))

Test 5

Group: 1, 2, 3

Verdict: ACCEPTED

input
6 2

correct output
()()()
()(())

user output
((()))
()()()

Test 6

Group: 1, 2, 3

Verdict:

input
6 4

correct output
()()()
(()())

user output
IMPOSSIBLE

Test 7

Group: 1, 2, 3

Verdict: ACCEPTED

input
8 0

correct output
()()()()
()()()()

user output
(((())))
(((())))

Test 8

Group: 1, 2, 3

Verdict: ACCEPTED

input
8 2

correct output
()()()()
()()(())

user output
(((())))
()(()())

Test 9

Group: 1, 2, 3

Verdict:

input
8 4

correct output
()()()()
()(()())

user output
IMPOSSIBLE

Test 10

Group: 1, 2, 3

Verdict:

input
8 6

correct output
()()()()
(()()())

user output
IMPOSSIBLE

Test 11

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 0

correct output
()()()()()
()()()()()

user output
((((()))))
((((()))))

Test 12

Group: 1, 2, 3

Verdict:

input
10 2

correct output
()()()()()
()()()(())

user output
((((()))))
()()()))))

Test 13

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 4

correct output
()()()()()
()()(()())

user output
((((()))))
()()()()()

Test 14

Group: 1, 2, 3

Verdict:

input
10 6

correct output
()()()()()
()(()()())

user output
IMPOSSIBLE

Test 15

Group: 1, 2, 3

Verdict:

input
10 8

correct output
()()()()()
(()()()())

user output
IMPOSSIBLE

Test 16

Group: 1, 2, 3

Verdict:

input
4 1

correct output
IMPOSSIBLE

user output
(())
(()(

Test 17

Group: 1, 2, 3

Verdict: ACCEPTED

input
4 4

correct output
IMPOSSIBLE

user output
IMPOSSIBLE

Test 18

Group: 1, 2, 3

Verdict: ACCEPTED

input
5 1

correct output
IMPOSSIBLE

user output
IMPOSSIBLE

Test 19

Group: 1, 2, 3

Verdict: ACCEPTED

input
5 2

correct output
IMPOSSIBLE

user output
IMPOSSIBLE

Test 20

Group: 2, 3

Verdict: ACCEPTED

input
100 0

correct output
()()()()()()()()()()()()()()()...

user output
((((((((((((((((((((((((((((((...
Truncated

Test 21

Group: 2, 3

Verdict:

input
100 10

correct output
()()()()()()()()()()()()()()()...

user output
((((((((((((((((((((((((((((((...
Truncated

Test 22

Group: 2, 3

Verdict:

input
100 42

correct output
()()()()()()()()()()()()()()()...

user output
((((((((((((((((((((((((((((((...
Truncated

Test 23

Group: 2, 3

Verdict:

input
100 80

correct output
()()()()()()()()()()()()()()()...

user output
IMPOSSIBLE

Test 24

Group: 2, 3

Verdict:

input
100 98

correct output
()()()()()()()()()()()()()()()...

user output
IMPOSSIBLE

Test 25

Group: 3

Verdict: ACCEPTED

input
1000000 0

correct output
()()()()()()()()()()()()()()()...

user output
((((((((((((((((((((((((((((((...
Truncated

Test 26

Group: 3

Verdict:

input
1000000 42

correct output
()()()()()()()()()()()()()()()...

user output
((((((((((((((((((((((((((((((...
Truncated

Test 27

Group: 3

Verdict:

input
1000000 4242

correct output
()()()()()()()()()()()()()()()...

user output
((((((((((((((((((((((((((((((...
Truncated

Test 28

Group: 3

Verdict:

input
1000000 424242

correct output
()()()()()()()()()()()()()()()...

user output
((((((((((((((((((((((((((((((...
Truncated

Test 29

Group: 3

Verdict:

input
1000000 999998

correct output
()()()()()()()()()()()()()()()...

user output
IMPOSSIBLE