CSES - Datatähti 2017 alku - Results
Submission details
Task:Pakkaus
Sender:Nipatiitti
Submission time:2016-10-11 11:56:20 +0300
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.15 s1details
#20.06 s1details
#30.06 s1details
#40.05 s1details
#50.06 s1details
#60.15 s2details
#70.05 s2details
#80.05 s2details
#90.06 s2details
#100.05 s2details
#110.19 s3details
#12--3details
#130.05 s3details
#140.05 s3details
#150.06 s3details

Code

#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
#include <ctype.h>
#include <cstdlib>
using namespace std;

int main()
{
    string data;
    getline (cin, data);
    string L1;
    string L2;
    string L3;
    string fin;
    int N1 = 0;
    int N2 = 0;
    int pos1 = 0;
    int pos2 = 0;
    int kerta = 1;
    int N3 = 0;
	int num = data.length();
    int pos = 0;
    while (pos-1 < num)
    {
        pos1 = data.find_first_of ("0123456789",pos);
        if (kerta == 1)
        {
            L1 = data.substr (pos, 1);
            N1 = atoi(L1.c_str());
            pos++;
            pos2 = data.find_first_of ("0123456789",pos);
            N2 = pos2-pos1-1;
            L2 = data.substr (pos1+1, N2);
            L3 = L2;
            for (int i=1;i<N1;i++)
            {
               L2 = L2 + L3;
            }
            fin = fin + L2;
            L1 = data.substr (pos2, 1);
            N3 = atoi(L1.c_str());
            L2 = "";
            N1 = 0;
            N2 = 0;
            pos1 = pos2;
            kerta = 2;
            pos++;
        }
        else
        {
            pos2 = data.find_first_of ("0123456789",pos1+1);
            if (data.find_first_of ("0123456789",pos1+1)== string::npos)
            {
                N2 = num-pos1-1;
                L2 = data.substr (pos1+1, N2);
                L3 = L2;
                for (int i=1;i<N3;i++)
                {
                    L2 = L2+L3;
                }
                fin = fin + L2;
                break;
            }
            else
            {
                N2 = pos2-pos1-1;
                L2 = data.substr (pos1+1, N2);
                L3 = L2;
                for (int i=1;i<N3;i++)
                {
                    L2 = L2+L3;
                }
                fin = fin + L2;
                L1 = data.substr (pos, 1);
                N3 = atoi(L1.c_str());
                N1 = 0;
                N2 = 0;
                pos1 = pos2;
                pos++;
            }
        }
    }
    cout<<fin;
return 0;
}

Test details

Test 1

Group: 1

Verdict:

input
1AAAAAAAAAAAAAAAAAAAA

correct output
AAAAAAAAAAAAAAAAAAAA

user output
(empty)

Error:
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::substr

Test 2

Group: 1

Verdict:

input
1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A...

correct output
AAAAAAAAAAAAAAAAAAAA

user output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

Test 3

Group: 1

Verdict:

input
20A

correct output
AAAAAAAAAAAAAAAAAAAA

user output
(empty)

Test 4

Group: 1

Verdict:

input
2N1J2F1XH2D2B2VT1N1ES

correct output
NNJFFXHDDBBVTVTNES

user output
NNJFFXHXHXHDDDBBBVTVTVTNNNNES

Test 5

Group: 1

Verdict:

input
2Z1E1UN1P2A2A1D2F2EZ1FZ1J

correct output
ZZEUNPAAAADFFEZEZFZJ

user output
ZZEUNUNPPPAAAAADDDFFEZEZEZFZFZ...

Test 6

Group: 2

Verdict:

input
1AAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

user output
(empty)

Error:
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::substr

Test 7

Group: 2

Verdict:

input
1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A...

correct output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

user output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

Test 8

Group: 2

Verdict:

input
1000A

correct output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

user output
A

Test 9

Group: 2

Verdict:

input
11QOUDQFAFUPAYCPXZ15KANCLRGT9S...

correct output
QOUDQFAFUPAYCPXZQOUDQFAFUPAYCP...

user output
KANCLRGTSPIGWCEELSPIGWCEELSPIG...

Test 10

Group: 2

Verdict:

input
20NFBIUXOSO10XRXZRMULZDUFK14BB...

correct output
NFBIUXOSONFBIUXOSONFBIUXOSONFB...

user output
XRXZRMULZDUFKBBLVZFKZKZKZKZKZK...

Test 11

Group: 3

Verdict:

input
1AAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

user output
(empty)

Error:
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::substr

Test 12

Group: 3

Verdict:

input
1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A...

correct output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

user output
(empty)

Test 13

Group: 3

Verdict:

input
1000000A

correct output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

user output
A

Test 14

Group: 3

Verdict:

input
87GEIGDBZCYGSFYYCGQUAWQJFUUAQG...

correct output
GEIGDBZCYGSFYYCGQUAWQJFUUAQGDT...

user output
JSRFZZPRIUXLRXYXDWEKVJKGEFEAKK...

Test 15

Group: 3

Verdict:

input
316XXYCLTBFQRAXHQPTLDB275NMQJD...

correct output
XXYCLTBFQRAXHQPTLDBXXYCLTBFQRA...

user output
XXYCLTBFQRAXHQPTLDBNMQJDAAVLZO...