Task: | Sulut |
Sender: | cppbetter |
Submission time: | 2024-01-20 16:19:29 +0200 |
Language: | C++ (C++20) |
Status: | READY |
Result: | 12 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 12 |
#2 | TIME LIMIT EXCEEDED | 0 |
#3 | TIME LIMIT EXCEEDED | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.00 s | 1, 2, 3 | details |
#2 | ACCEPTED | 0.00 s | 1, 2, 3 | details |
#3 | ACCEPTED | 0.00 s | 1, 2, 3 | details |
#4 | ACCEPTED | 0.00 s | 1, 2, 3 | details |
#5 | ACCEPTED | 0.00 s | 1, 2, 3 | details |
#6 | ACCEPTED | 0.00 s | 1, 2, 3 | details |
#7 | ACCEPTED | 0.00 s | 1, 2, 3 | details |
#8 | ACCEPTED | 0.00 s | 1, 2, 3 | details |
#9 | ACCEPTED | 0.00 s | 1, 2, 3 | details |
#10 | ACCEPTED | 0.00 s | 1, 2, 3 | details |
#11 | ACCEPTED | 0.00 s | 1, 2, 3 | details |
#12 | ACCEPTED | 0.00 s | 1, 2, 3 | details |
#13 | ACCEPTED | 0.00 s | 1, 2, 3 | details |
#14 | ACCEPTED | 0.00 s | 1, 2, 3 | details |
#15 | ACCEPTED | 0.00 s | 1, 2, 3 | details |
#16 | ACCEPTED | 0.00 s | 1, 2, 3 | details |
#17 | ACCEPTED | 0.00 s | 1, 2, 3 | details |
#18 | ACCEPTED | 0.00 s | 1, 2, 3 | details |
#19 | ACCEPTED | 0.00 s | 1, 2, 3 | details |
#20 | ACCEPTED | 0.00 s | 2, 3 | details |
#21 | ACCEPTED | 0.01 s | 2, 3 | details |
#22 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
#23 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
#24 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
#25 | ACCEPTED | 0.03 s | 3 | details |
#26 | TIME LIMIT EXCEEDED | -- | 3 | details |
#27 | TIME LIMIT EXCEEDED | -- | 3 | details |
#28 | TIME LIMIT EXCEEDED | -- | 3 | details |
#29 | TIME LIMIT EXCEEDED | -- | 3 | details |
Code
#include <bits/stdc++.h> using namespace std; using ll = int64_t; string s1, s2; ll n, k; ll t1 = 0, t2 = 0; bool chk() { ll d = 0; for(ll i = 0; i < n; i++) { if(s1[i] != s2[i]) d++; } return d == k; } void handle(ll i) { if(i == n && chk() && t1 == 0 && t2 == 0) { cout << s1 << "\n" << s2 << "\ns"; exit(0); } else if(i < n) { if(t1 > 0) { t1--; s1[i] = ')'; if(t2 > 0) { t2--; s2[i] = ')'; handle(i + 1); t2++; } t2++; s2[i] = '('; handle(i + 1); t2--; t1++; } t1++; s1[i] = '('; if(t2 > 0) { t2--; s2[i] = ')'; handle(i + 1); t2++; } t2++; s2[i] = '('; handle(i + 1); t2--; t1--; } } int main() { cin >> n >> k; if(k % 2 != 0 || n % 2 != 0) { cout << "IMPOSSIBLE\n"; } else { s1.resize(n); s2.resize(n); handle(0); cout << "IMPOSSIBLE\n"; } return 0; }
Test details
Test 1
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
2 0 |
correct output |
---|
() () |
user output |
---|
() () s |
Test 2
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
4 0 |
correct output |
---|
()() ()() |
user output |
---|
()() ()() s |
Test 3
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
4 2 |
correct output |
---|
()() (()) |
user output |
---|
()() (()) s |
Test 4
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
6 0 |
correct output |
---|
()()() ()()() |
user output |
---|
()()() ()()() s |
Test 5
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
6 2 |
correct output |
---|
()()() ()(()) |
user output |
---|
()()() ()(()) s |
Test 6
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
6 4 |
correct output |
---|
()()() (()()) |
user output |
---|
()()() (()()) s |
Test 7
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
8 0 |
correct output |
---|
()()()() ()()()() |
user output |
---|
()()()() ()()()() s |
Test 8
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
8 2 |
correct output |
---|
()()()() ()()(()) |
user output |
---|
()()()() ()()(()) s |
Test 9
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
8 4 |
correct output |
---|
()()()() ()(()()) |
user output |
---|
()()()() ()(()()) s |
Test 10
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
8 6 |
correct output |
---|
()()()() (()()()) |
user output |
---|
()()()() (()()()) s |
Test 11
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
10 0 |
correct output |
---|
()()()()() ()()()()() |
user output |
---|
()()()()() ()()()()() s |
Test 12
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
10 2 |
correct output |
---|
()()()()() ()()()(()) |
user output |
---|
()()()()() ()()()(()) s |
Test 13
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
10 4 |
correct output |
---|
()()()()() ()()(()()) |
user output |
---|
()()()()() ()()(()()) s |
Test 14
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
10 6 |
correct output |
---|
()()()()() ()(()()()) |
user output |
---|
()()()()() ()(()()()) s |
Test 15
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
10 8 |
correct output |
---|
()()()()() (()()()()) |
user output |
---|
()()()()() (()()()()) s |
Test 16
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
4 1 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
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: ACCEPTED
input |
---|
100 10 |
correct output |
---|
()()()()()()()()()()()()()()()... |
user output |
---|
()()()()()()()()()()()()()()()... Truncated |
Test 22
Group: 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 42 |
correct output |
---|
()()()()()()()()()()()()()()()... |
user output |
---|
(empty) |
Test 23
Group: 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 80 |
correct output |
---|
()()()()()()()()()()()()()()()... |
user output |
---|
(empty) |
Test 24
Group: 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 98 |
correct output |
---|
()()()()()()()()()()()()()()()... |
user output |
---|
(empty) |
Test 25
Group: 3
Verdict: ACCEPTED
input |
---|
1000000 0 |
correct output |
---|
()()()()()()()()()()()()()()()... |
user output |
---|
()()()()()()()()()()()()()()()... Truncated |
Test 26
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000000 42 |
correct output |
---|
()()()()()()()()()()()()()()()... |
user output |
---|
(empty) |
Test 27
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000000 4242 |
correct output |
---|
()()()()()()()()()()()()()()()... |
user output |
---|
(empty) |
Test 28
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000000 424242 |
correct output |
---|
()()()()()()()()()()()()()()()... |
user output |
---|
(empty) |
Test 29
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000000 999998 |
correct output |
---|
()()()()()()()()()()()()()()()... |
user output |
---|
(empty) |