CSES - Datatähti 2022 loppu - Results
Submission details
Task:Lista
Sender:Anttono
Submission time:2022-01-22 15:24:15 +0200
Language:C++11
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.01 s1, 2, 3details
#20.04 s2, 3details
#3--3details
#40.01 s1, 2, 3details
#50.01 s1, 2, 3details
#60.01 s1, 2, 3details
#70.01 s1, 2, 3details
#80.83 s3details
#9--3details
#10--3details

Compiler report

input/code.cpp: In function 'bool eq(std::__cxx11::string, int)':
input/code.cpp:13:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<s.size();i++)
                 ~^~~~~~~~~
input/code.cpp: In function 'int main()':
input/code.cpp:41:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         while(s.size()>dig(nxt)) nxt++;
               ~~~~~~~~^~~~~~~~~
input/code.cpp:42:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         while(!eq(s, nxt) && s.size()==dig(nxt)) nxt++;
                              ~~~~~~~~^~~~~~~~~~
input/code.cpp:43:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(s.size()<dig(nxt))
            ~~~~~~~~^~~~~~~~~

Code

#include <bits/stdc++.h>

using namespace std;

int n;
bool pos = true;
vector<int> r;

bool eq(string s, int x)
{
    bool res = true;
    reverse(s.begin(), s.end());
    for(int i=0;i<s.size();i++)
    {
        if(s[i] != '?' && s[i]-'0' != x%10) res = false;
        x /= 10;
    }
    return res;
}

int dig(int x)
{
    int res = 0;
    while(x>0)
    {
        res++;
        x /= 10;
    }
    return res;
}

int main()
{
    cout<<eq("105", 150)<<'\n';
    cin>>n;
    string s;
    int nxt = 1;
    for(int i=0;i<n;i++)
    {
        cin>>s;
        while(s.size()>dig(nxt)) nxt++;
        while(!eq(s, nxt) && s.size()==dig(nxt)) nxt++;
        if(s.size()<dig(nxt))
        {
            pos = false;
            break;
        }
        r.push_back(nxt);
        nxt++;
    }

    if(pos) for(int i=0;i<n;i++)
    {
        cout<<r[i]<<'\n';
    }
    else cout<<"IMPOSSIBLE";
}

Test details

Test 1

Group: 1, 2, 3

Verdict:

input
100
??
??
??
??
...

correct output
10
11
12
13
20
...

user output
0
10
11
12
13
...

Test 2

Group: 2, 3

Verdict:

input
1000
8??
??8?
????
????
...

correct output
800
1080
1081
1082
1083
...

user output
0
800
1080
1081
1082
...

Test 3

Group: 3

Verdict:

input
1000
??????
?????9?
??98???
?????5?
...

correct output
100000
1000090
1098000
1098050
4100001
...

user output
(empty)

Test 4

Group: 1, 2, 3

Verdict:

input
100
?
?
?
?
...

correct output
1
2
3
4
5
...

user output
0
1
2
3
4
...

Test 5

Group: 1, 2, 3

Verdict:

input
2
???
??

correct output
IMPOSSIBLE

user output
0
IMPOSSIBLE

Test 6

Group: 1, 2, 3

Verdict:

input
3
123
???
124

correct output
IMPOSSIBLE

user output
0
IMPOSSIBLE

Test 7

Group: 1, 2, 3

Verdict:

input
5
1??
???
2??
???
...

correct output
IMPOSSIBLE

user output
0
IMPOSSIBLE

Test 8

Group: 3

Verdict:

input
1000
?????????
?????????
?????????
?????????
...

correct output
100000000
100000001
100000002
100000003
100000004
...

user output
0
100000000
100000001
100000002
100000003
...

Test 9

Group: 3

Verdict:

input
900
???000000
???000000
???000000
???000000
...

correct output
100000000
101000000
102000000
103000000
104000000
...

user output
(empty)

Test 10

Group: 3

Verdict:

input
1000
???1?????
???0?????
???1?????
???0?????
...

correct output
100100000
101000000
101100000
102000000
102100000
...

user output
(empty)