CSES - Datatähti 2017 alku - Results
Submission details
Task:Pakkaus
Sender:3isagreatnumber
Submission time:2016-10-05 12:21:13 +0300
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.14 s1details
#20.15 s1details
#3ACCEPTED0.06 s1details
#40.12 s1details
#50.15 s1details
#60.14 s2details
#70.14 s2details
#8ACCEPTED0.05 s2details
#9ACCEPTED0.06 s2details
#10ACCEPTED0.06 s2details
#110.18 s3details
#120.25 s3details
#13ACCEPTED0.09 s3details
#14ACCEPTED0.05 s3details
#15ACCEPTED0.05 s3details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:64:5: warning: 's_h' may be used uninitialized in this function [-Wmaybe-uninitialized]
     for (ull j = s_l; j <= s_h; j++)
     ^
input/code.cpp:34:13: warning: 'n_h' may be used uninitialized in this function [-Wmaybe-uninitialized]
             for (ull j = n_l; j <= n_h; j++)
             ^

Code

#include <iostream>
#include <string>
#include <vector>
#include <ctype.h>
#include <stdlib.h>
#define ull unsigned long long

using namespace std;

int main(void)
{
    string s;
    cin >> s;

    vector<ull> n;
    vector<string> str;

    ull n_l = 0;
    ull n_h;
    ull s_l;
    ull s_h;

    for (ull i = 1; i < s.length(); i++)
    {
        // move n upper bound
        if (isdigit(s[i]) && isdigit(s[i-1]))
        {
            n_h = i;
        }
        else if (!isdigit(s[i]) && isdigit(s[i-1]))
        {
            // save number
            string tmp;
            for (ull j = n_l; j <= n_h; j++)
            {
                tmp+=s[j];
            }
            n.push_back(atoi(tmp.c_str()));

            // store s lower bound
            s_l = i;
            s_h = i;
        }
        else if (!isdigit(s[i]) && !isdigit(s[i-1]))
        {
            s_h = i;
        }
        else if (!isdigit(s[i-1]) && isdigit(s[i]))
        {
            n_l = i;
            n_h = i;
            
            // save string 
            string tmp;
            for (ull j = s_l; j <= s_h; j++)
            {
                tmp+=s[j];
            }
            str.push_back(tmp);
        }

    }
    string tmp;
    for (ull j = s_l; j <= s_h; j++)
    {
        tmp+=s[j];
    }
    str.push_back(tmp);

    for (ull i = 0; i < n.size(); i++)
    {
        for (ull j = 0; j < n[i]; j++)
        {
            cout << str[i];
        }
    }
    cout << endl;
}

Test details

Test 1

Group: 1

Verdict:

input
1AAAAAAAAAAAAAAAAAAAA

correct output
AAAAAAAAAAAAAAAAAAAA

user output
(empty)

Test 2

Group: 1

Verdict:

input
1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A...

correct output
AAAAAAAAAAAAAAAAAAAA

user output
(empty)

Test 3

Group: 1

Verdict: ACCEPTED

input
20A

correct output
AAAAAAAAAAAAAAAAAAAA

user output
AAAAAAAAAAAAAAAAAAAA

Test 4

Group: 1

Verdict:

input
2N1J2F1XH2D2B2VT1N1ES

correct output
NNJFFXHDDBBVTVTNES

user output
(empty)

Test 5

Group: 1

Verdict:

input
2Z1E1UN1P2A2A1D2F2EZ1FZ1J

correct output
ZZEUNPAAAADFFEZEZFZJ

user output
(empty)

Test 6

Group: 2

Verdict:

input
1AAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

user output
(empty)

Test 7

Group: 2

Verdict:

input
1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A...

correct output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

user output
(empty)

Test 8

Group: 2

Verdict: ACCEPTED

input
1000A

correct output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

user output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...
Truncated

Test 9

Group: 2

Verdict: ACCEPTED

input
11QOUDQFAFUPAYCPXZ15KANCLRGT9S...

correct output
QOUDQFAFUPAYCPXZQOUDQFAFUPAYCP...

user output
QOUDQFAFUPAYCPXZQOUDQFAFUPAYCP...
Truncated

Test 10

Group: 2

Verdict: ACCEPTED

input
20NFBIUXOSO10XRXZRMULZDUFK14BB...

correct output
NFBIUXOSONFBIUXOSONFBIUXOSONFB...

user output
NFBIUXOSONFBIUXOSONFBIUXOSONFB...
Truncated

Test 11

Group: 3

Verdict:

input
1AAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

user output
(empty)

Test 12

Group: 3

Verdict:

input
1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A...

correct output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

user output
(empty)

Test 13

Group: 3

Verdict: ACCEPTED

input
1000000A

correct output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

user output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...
Truncated

Test 14

Group: 3

Verdict: ACCEPTED

input
87GEIGDBZCYGSFYYCGQUAWQJFUUAQG...

correct output
GEIGDBZCYGSFYYCGQUAWQJFUUAQGDT...

user output
GEIGDBZCYGSFYYCGQUAWQJFUUAQGDT...
Truncated

Test 15

Group: 3

Verdict: ACCEPTED

input
316XXYCLTBFQRAXHQPTLDB275NMQJD...

correct output
XXYCLTBFQRAXHQPTLDBXXYCLTBFQRA...

user output
XXYCLTBFQRAXHQPTLDBXXYCLTBFQRA...
Truncated