CSES - Datatähti 2017 alku - Results
Submission details
Task:Pakkaus
Sender:3isagreatnumber
Submission time:2016-10-05 12:15:43 +0300
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.13 s1details
#20.15 s1details
#3ACCEPTED0.05 s1details
#40.15 s1details
#50.13 s1details
#60.14 s2details
#70.15 s2details
#8ACCEPTED0.06 s2details
#9ACCEPTED0.05 s2details
#10ACCEPTED0.05 s2details
#110.19 s3details
#120.22 s3details
#13ACCEPTED0.08 s3details
#14ACCEPTED0.05 s3details
#15ACCEPTED0.05 s3details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:22:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 1; i < s.length(); i++)
                                  ^
input/code.cpp:69:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < n.size(); i++)
                                ^
input/code.cpp:63:5: warning: 's_h' may be used uninitialized in this function [-Wmaybe-uninitialized]
     for (int j = s_l; j <= s_h; j++)
     ^
input/code.cpp:19:9: warning: 's_l' may be used uninitialized in this function [-Wmaybe-uninitialized]
     int s_l;
         ^
input/code.cpp:33:13: warning: 'n_h' may be used uninitialized in this function [-Wmaybe-uninitialized]
             for (int j = n_l; j <= n_h; j++)
             ^

Code

#include <iostream>
#include <string>
#include <vector>
#include <ctype.h>
#include <stdlib.h>

using namespace std;

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

    vector<int> n;
    vector<string> str;

    int n_l = 0;
    int n_h;
    int s_l;
    int s_h;

    for (int 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 (int 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 (int j = s_l; j <= s_h; j++)
            {
                tmp+=s[j];
            }
            str.push_back(tmp);
        }

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

    for (int i = 0; i < n.size(); i++)
    {
        for (int 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