CSES - KILO 2017 3/5 - Results
Submission details
Task:Regular Bracket Sequence
Sender:Qianyun Guo
Submission time:2017-09-19 17:26:34 +0300
Language:C++
Status:READY
Result:ACCEPTED
Test results
testverdicttime
#1ACCEPTED0.03 sdetails
#2ACCEPTED0.05 sdetails
#3ACCEPTED0.05 sdetails
#4ACCEPTED0.05 sdetails
#5ACCEPTED0.04 sdetails
#6ACCEPTED0.04 sdetails
#7ACCEPTED0.05 sdetails
#8ACCEPTED0.03 sdetails
#9ACCEPTED0.06 sdetails
#10ACCEPTED0.04 sdetails
#11ACCEPTED0.04 sdetails
#12ACCEPTED0.04 sdetails
#13ACCEPTED0.04 sdetails
#14ACCEPTED0.05 sdetails
#15ACCEPTED0.05 sdetails
#16ACCEPTED0.05 sdetails
#17ACCEPTED0.05 sdetails
#18ACCEPTED0.04 sdetails
#19ACCEPTED0.04 sdetails
#20ACCEPTED0.03 sdetails
#21ACCEPTED0.04 sdetails
#22ACCEPTED0.04 sdetails
#23ACCEPTED0.04 sdetails
#24ACCEPTED0.06 sdetails
#25ACCEPTED0.05 sdetails
#26ACCEPTED0.04 sdetails
#27ACCEPTED0.04 sdetails
#28ACCEPTED0.04 sdetails
#29ACCEPTED0.05 sdetails
#30ACCEPTED0.04 sdetails

Code

#include<bits/stdc++.h>

using namespace std;

int n, a, b;
void print_double(int x, string s) {
    assert(x % 2== 0);
    for (int i = 0; i < x/2; i++)
        cout << s;
}

bool even(int x) {
    return x % 2 == 0;
}

int main() {
    cin >> n >> a >> b;
    if (!even(n) || !even(b-a+1)){
        cout << "QAQ" << endl;
        return 0;
    }

    if (even(a)) {
        cout << "(";
        print_double(a-2, "()");
        print_double(b-a+1, "[]");
        print_double(n-b-1, "()");
        cout << ")";
    } else {
        print_double(a-1, "()");
        print_double(b-a+1, "[]");
        print_double(n-b, "()");
    }
    cout << endl;
    return 0;
}

Test details

Test 1

Verdict: ACCEPTED

input
4 3 4

correct output
()[]

user output
()[]

Test 2

Verdict: ACCEPTED

input
6 6 6

correct output
QAQ

user output
QAQ

Test 3

Verdict: ACCEPTED

input
2 1 2

correct output
[]

user output
[]

Test 4

Verdict: ACCEPTED

input
4 1 4

correct output
[][]

user output
[][]

Test 5

Verdict: ACCEPTED

input
6 1 6

correct output
[][][]

user output
[][][]

Test 6

Verdict: ACCEPTED

input
7 1 2

correct output
QAQ

user output
QAQ

Test 7

Verdict: ACCEPTED

input
6 4 6

correct output
QAQ

user output
QAQ

Test 8

Verdict: ACCEPTED

input
8 1 2

correct output
[]()()()

user output
[]()()()

Test 9

Verdict: ACCEPTED

input
8 5 8

correct output
()()[][]

user output
()()[][]

Test 10

Verdict: ACCEPTED

input
4 3 4

correct output
()[]

user output
()[]

Test 11

Verdict: ACCEPTED

input
89 39 60

correct output
QAQ

user output
QAQ

Test 12

Verdict: ACCEPTED

input
52 23 42

correct output
()()()()()()()()()()()[][][][]...

user output
()()()()()()()()()()()[][][][]...

Test 13

Verdict: ACCEPTED

input
90 65 88

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

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

Test 14

Verdict: ACCEPTED

input
82 12 45

correct output
()()()()()([][][][][][][][][][...

user output
(()()()()()[][][][][][][][][][...

Test 15

Verdict: ACCEPTED

input
28 12 27

correct output
()()()()()([][][][][][][][])

user output
(()()()()()[][][][][][][][])

Test 16

Verdict: ACCEPTED

input
98 34 95

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

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

Test 17

Verdict: ACCEPTED

input
66 11 54

correct output
()()()()()[][][][][][][][][][]...

user output
()()()()()[][][][][][][][][][]...

Test 18

Verdict: ACCEPTED

input
72 21 50

correct output
()()()()()()()()()()[][][][][]...

user output
()()()()()()()()()()[][][][][]...

Test 19

Verdict: ACCEPTED

input
24 3 18

correct output
()[][][][][][][][]()()()

user output
()[][][][][][][][]()()()

Test 20

Verdict: ACCEPTED

input
56 12 55

correct output
()()()()()([][][][][][][][][][...

user output
(()()()()()[][][][][][][][][][...

Test 21

Verdict: ACCEPTED

input
65 4 25

correct output
QAQ

user output
QAQ

Test 22

Verdict: ACCEPTED

input
44 16 39

correct output
()()()()()()()([][][][][][][][...

user output
(()()()()()()()[][][][][][][][...

Test 23

Verdict: ACCEPTED

input
66 10 23

correct output
()()()()([][][][][][][])()()()...

user output
(()()()()[][][][][][][]()()()(...

Test 24

Verdict: ACCEPTED

input
96 30 43

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

user output
(()()()()()()()()()()()()()()[...

Test 25

Verdict: ACCEPTED

input
84 15 84

correct output
()()()()()()()[][][][][][][][]...

user output
()()()()()()()[][][][][][][][]...

Test 26

Verdict: ACCEPTED

input
91 68 79

correct output
QAQ

user output
QAQ

Test 27

Verdict: ACCEPTED

input
98 30 87

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

user output
(()()()()()()()()()()()()()()[...

Test 28

Verdict: ACCEPTED

input
32 10 19

correct output
()()()()([][][][][])()()()()()...

user output
(()()()()[][][][][]()()()()()(...

Test 29

Verdict: ACCEPTED

input
100 97 100

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

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

Test 30

Verdict: ACCEPTED

input
74 60 63

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

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