Code Submission Evaluation System Login

HIIT Open 2017

Start:2017-05-27 11:00:00
End:2017-05-27 16:00:00
 

Tasks | Messages | Scoreboard | Statistics


CSES - HIIT Open 2017 - Results
History
2017-05-27 11:49:54
Task:Dynamic duo
Sender:HIIT AND RUN
Submission time:2017-05-27 11:49:54
Language:C++
Status:READY
Result:ACCEPTED

Test results

testverdicttime (s)
#1ACCEPTED0.03 / 1.00details
#2ACCEPTED0.07 / 1.00details
#3ACCEPTED0.05 / 1.00details
#4ACCEPTED0.06 / 1.00details
#5ACCEPTED0.04 / 1.00details
#6ACCEPTED0.07 / 1.00details
#7ACCEPTED0.05 / 1.00details
#8ACCEPTED0.04 / 1.00details
#9ACCEPTED0.05 / 1.00details
#10ACCEPTED0.05 / 1.00details
#11ACCEPTED0.06 / 1.00details
#12ACCEPTED0.05 / 1.00details
#13ACCEPTED0.04 / 1.00details
#14ACCEPTED0.05 / 1.00details
#15ACCEPTED0.04 / 1.00details
#16ACCEPTED0.03 / 1.00details
#17ACCEPTED0.04 / 1.00details
#18ACCEPTED0.04 / 1.00details
#19ACCEPTED0.05 / 1.00details
#20ACCEPTED0.06 / 1.00details
#21ACCEPTED0.05 / 1.00details
#22ACCEPTED0.04 / 1.00details
#23ACCEPTED0.05 / 1.00details
#24ACCEPTED0.04 / 1.00details
#25ACCEPTED0.06 / 1.00details
#26ACCEPTED0.06 / 1.00details
#27ACCEPTED0.05 / 1.00details
#28ACCEPTED0.07 / 1.00details
#29ACCEPTED0.06 / 1.00details
#30ACCEPTED0.04 / 1.00details
#31ACCEPTED0.05 / 1.00details
#32ACCEPTED0.05 / 1.00details
#33ACCEPTED0.05 / 1.00details
#34ACCEPTED0.05 / 1.00details
#35ACCEPTED0.04 / 1.00details
#36ACCEPTED0.04 / 1.00details
#37ACCEPTED0.05 / 1.00details
#38ACCEPTED0.04 / 1.00details
#39ACCEPTED0.05 / 1.00details
#40ACCEPTED0.05 / 1.00details
#41ACCEPTED0.04 / 1.00details
#42ACCEPTED0.06 / 1.00details
#43ACCEPTED0.04 / 1.00details
#44ACCEPTED0.06 / 1.00details
#45ACCEPTED0.05 / 1.00details
#46ACCEPTED0.04 / 1.00details
#47ACCEPTED0.05 / 1.00details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:18:17: warning: array subscript has type 'char' [-Wchar-subscripts]
         asd[s[i]]++; 
                 ^
input/code.cpp:32:21: warning: array subscript has type 'char' [-Wchar-subscripts]
         while (asd[i] > 0) {
                     ^
input/code.cpp:33:18: warning: array subscript has type 'char' [-Wchar-subscripts]
             asd[i]--;
                  ^
input/code.cpp:35:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if (a.size() == n/2) break;
                               ^
input/code.cpp:37:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (a.size() == n/2) break;
                           ^
input/code.cpp:42:21: warning: array subscript has type 'char' [-Wchar-subscripts]
         while (asd[i] > 0) {
                     ^
input/code.cpp:43:18: warning: array subscript has type 'char' [-Wchar-subscripts]
             asd[i]--;
                  ^
input/code.cpp:45:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if (b.size() == n/2) break;
                               ^
input/code.cpp:47:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (b.size() == n/2) break;
                           ^

Code

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int asd[256];

int main() {
    ios_base::sync_with_stdio(0);

    string s;
    cin >> s;
    ll n = s.size();
    


    for (int i = 0; i < n; i++) {
        asd[s[i]]++; 
    }
    
    for (int i = 0; i < 256; i++) {
        if (asd[i] > (n / 2)) {
            cout << "-1" << endl;
            return 0;
        }
    }
    
    string a = "";
    string b = "";
    
    for(char i = 'A'; i <= 'Z'; i++) {
        while (asd[i] > 0) {
            asd[i]--;
            a += i;
            if (a.size() == n/2) break;
        }
        if (a.size() == n/2) break;
    }
    
    
    for(char i = 'A'; i <= 'Z'; i++) {
        while (asd[i] > 0) {
            asd[i]--;
            b += i;
            if (b.size() == n/2) break;
        }
        if (b.size() == n/2) break;
    }

    cout << a << endl;
    cout << b << endl;
    
}

Test details

Test 1

Verdict: ACCEPTED

input
BA
view   save

correct output
A
B
view   save

user output
A
B
view   save

Test 2

Verdict: ACCEPTED

input
AA
view   save

correct output
-1
view   save

user output
-1
view   save

Test 3

Verdict: ACCEPTED

input
CAAB
view   save

correct output
AA
BC
view   save

user output
AA
BC
view   save

Test 4

Verdict: ACCEPTED

input
BABA
view   save

correct output
AA
BB
view   save

user output
AA
BB
view   save

Test 5

Verdict: ACCEPTED

input
BBCCAA
view   save

correct output
AAB
BCC
view   save

user output
AAB
BCC
view   save

Test 6

Verdict: ACCEPTED

input
AAAB
view   save

correct output
-1
view   save

user output
-1
view   save

Test 7

Verdict: ACCEPTED

input
BAABAC
view   save

correct output
AAA
BBC
view   save

user output
AAA
BBC
view   save

Test 8

Verdict: ACCEPTED

input
ABABAB
view   save

correct output
AAA
BBB
view   save

user output
AAA
BBB
view   save

Test 9

Verdict: ACCEPTED

input
BCBACAAB
view   save

correct output
AAAB
BBCC
view   save

user output
AAAB
BBCC
view   save

Test 10

Verdict: ACCEPTED

input
AAAA
view   save

correct output
-1
view   save

user output
-1
view   save

Test 11

Verdict: ACCEPTED

input
AABCAA
view   save

correct output
-1
view   save

user output
-1
view   save

Test 12

Verdict: ACCEPTED

input
AAABBA
view   save

correct output
-1
view   save

user output
-1
view   save

Test 13

Verdict: ACCEPTED

input
BBAACCAA
view   save

correct output
AAAA
BBCC
view   save

user output
AAAA
BBCC
view   save

Test 14

Verdict: ACCEPTED

input
ABAACBBA
view   save

correct output
AAAA
BBBC
view   save

user output
AAAA
BBBC
view   save

Test 15

Verdict: ACCEPTED

input
BBCCABAAAC
view   save

correct output
AAAAB
BBCCC
view   save

user output
AAAAB
BBCCC
view   save

Test 16

Verdict: ACCEPTED

input
BAAABABB
view   save

correct output
AAAA
BBBB
view   save

user output
AAAA
BBBB
view   save

Test 17

Verdict: ACCEPTED

input
CBBACABBAA
view   save

correct output
AAAAB
BBBCC
view   save

user output
AAAAB
BBBCC
view   save

Test 18

Verdict: ACCEPTED

input
BCACBAACBABC
view   save

correct output
AAAABB
BBCCCC
view   save

user output
AAAABB
BBCCCC
view   save

Test 19

Verdict: ACCEPTED

input
AAAABA
view   save

correct output
-1
view   save

user output
-1
view   save

Test 20

Verdict: ACCEPTED

input
BAAAACBA
view   save

correct output
-1
view   save

user output
-1
view   save

Test 21

Verdict: ACCEPTED

input
BBAAAABA
view   save

correct output
-1
view   save

user output
-1
view   save

Test 22

Verdict: ACCEPTED

input
BAACCBABAA
view   save

correct output
AAAAA
BBBCC
view   save

user output
AAAAA
BBBCC
view   save

Test 23

Verdict: ACCEPTED

input
BABACAABAB
view   save

correct output
AAAAA
BBBBC
view   save

user output
AAAAA
BBBBC
view   save

Test 24

Verdict: ACCEPTED

input
CCAABBABCBAA
view   save

correct output
AAAAAB
BBBCCC
view   save

user output
AAAAAB
BBBCCC
view   save

Test 25

Verdict: ACCEPTED

input
AABBAAABBB
view   save

correct output
AAAAA
BBBBB
view   save

user output
AAAAA
BBBBB
view   save

Test 26

Verdict: ACCEPTED

input
BABAACACBBAB
view   save

correct output
AAAAAB
BBBBCC
view   save

user output
AAAAAB
BBBBCC
view   save

Test 27

Verdict: ACCEPTED

input
AABBBCCABCABAC
view   save

correct output
AAAAABB
BBBCCCC
view   save

user output
AAAAABB
BBBCCCC
view   save

Test 28

Verdict: ACCEPTED

input
AAAAAA
view   save

correct output
-1
view   save

user output
-1
view   save

Test 29

Verdict: ACCEPTED

input
AABACAAA
view   save

correct output
-1
view   save

user output
-1
view   save

Test 30

Verdict: ACCEPTED

input
BAAABAAA
view   save

correct output
-1
view   save

user output
-1
view   save

Test 31

Verdict: ACCEPTED

input
ABAABAACAC
view   save

correct output
-1
view   save

user output
-1
view   save

Test 32

Verdict: ACCEPTED

input
AAAABACBBA
view   save

correct output
-1
view   save

user output
-1
view   save

Test 33

Verdict: ACCEPTED

input
BABCCBAACAAA
view   save

correct output
AAAAAA
BBBCCC
view   save

user output
AAAAAA
BBBCCC
view   save

Test 34

Verdict: ACCEPTED

input
BBBAAAABAA
view   save

correct output
-1
view   save

user output
-1
view   save

Test 35

Verdict: ACCEPTED

input
ABBABBAAACCA
view   save

correct output
AAAAAA
BBBBCC
view   save

user output
AAAAAA
BBBBCC
view   save

Test 36

Verdict: ACCEPTED

input
BCACABBACACABA
view   save

correct output
AAAAAAB
BBBCCCC
view   save

user output
AAAAAAB
BBBCCCC
view   save

Test 37

Verdict: ACCEPTED

input
BAABCBAAAABB
view   save

correct output
AAAAAA
BBBBBC
view   save

user output
AAAAAA
BBBBBC
view   save

Test 38

Verdict: ACCEPTED

input
ABBAACCABBCABA
view   save

correct output
AAAAAAB
BBBBCCC
view   save

user output
AAAAAAB
BBBBCCC
view   save

Test 39

Verdict: ACCEPTED

input
ABCACCBABBAACABC
view   save

correct output
AAAAAABB
BBBCCCCC
view   save

user output
AAAAAABB
BBBCCCCC
view   save

Test 40

Verdict: ACCEPTED

input
ABBBAAABBABA
view   save

correct output
AAAAAA
BBBBBB
view   save

user output
AAAAAA
BBBBBB
view   save

Test 41

Verdict: ACCEPTED

input
AAACAABBCABBBB
view   save

correct output
AAAAAAB
BBBBBCC
view   save

user output
AAAAAAB
BBBBBCC
view   save

Test 42

Verdict: ACCEPTED

input
BCBBBCAABABCCAAA
view   save

correct output
AAAAAABB
BBBBCCCC
view   save

user output
AAAAAABB
BBBBCCCC
view   save

Test 43

Verdict: ACCEPTED

input
BBCBAABACCCBAACACB
view   save

correct output
AAAAAABBB
BBBCCCCCC
view   save

user output
AAAAAABBB
BBBCCCCCC
view   save

Test 44

Verdict: ACCEPTED

input
BBABBABABAABAAABBAAABBBBBBAABB...
view   save

correct output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...
view   save

user output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...
view   save

Test 45

Verdict: ACCEPTED

input
AAAABABABBBBABAABBBABBBBBABBAB...
view   save

correct output
-1
view   save

user output
-1
view   save

Test 46

Verdict: ACCEPTED

input
ABBBAABAABAAABBAAAAABBBABAAAAB...
view   save

correct output
-1
view   save

user output
-1
view   save

Test 47

Verdict: ACCEPTED

input
XOQPQRNTLADFTEQSZYBMIRXWHSQDCM...
view   save

correct output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...
view   save

user output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...
view   save