CSES - Datatähti 2021 loppu - Results
Submission details
Task:Suuremmat
Sender:intoo
Submission time:2021-01-23 16:12:35 +0200
Language:C++ (C++17)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
Test results
testverdicttimegroup
#10.01 s1, 2details
#20.01 s2details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:13:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 1; i < n.size(); ++i) {
                   ~~^~~~~~~~~~
input/code.cpp:23:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i <= n.size(); ++i)
                     ~~^~~~~~~~~~~
input/code.cpp:27:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < n.size(); ++i)
                     ~~^~~~~~~~~~

Code

#include <iostream>
using namespace std;
using ll = long long;
int main() {
int t;
string n;
cin >> t;
while (t --> 0) {
cin >> n;
int k = -1;
for (int i = 1; i < n.size(); ++i) {
if (n[i-1] > n[i]) {
k = n[0]-'0';
break;
} else if (n[i-1] < n[i]) {
k = n[0]-'0'+1;
}
}
if (k == -1) {
if (n[0] == '9') {
for (int i = 0; i <= n.size(); ++i)
cout << 1;
cout << endl;
} else {
for (int i = 0; i < n.size(); ++i)
cout << n[0]-'0'+1;
cout << endl;
}
} else {
int s = n.size();
if (k == 10) {
k = 1;
++s;
}
for (int i = 0; i < s; ++i)
cout << k;
cout << endl;
}
}
}

Test details

Test 1

Group: 1, 2

Verdict:

input
1000
1
2
3
4
...

correct output
2
3
4
5
6
...

user output
2
3
4
5
6
...
Truncated

Test 2

Group: 2

Verdict:

input
1000
735425311146082632
756615631808964686
466489470801941584
100417544394053220
...

correct output
777777777777777777
777777777777777777
555555555555555555
111111111111111111
555555555555555555
...

user output
777777777777777777
777777777777777777
444444444444444444
111111111111111111
44444444444444
...
Truncated