CSES - Datatähti 2021 loppu - Results
Submission details
Task:Suuremmat
Sender:jubidubi
Submission time:2021-01-23 16:11:06 +0200
Language:C++11
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED35
#2ACCEPTED65
Test results
testverdicttimegroup
#1ACCEPTED0.01 s1, 2details
#2ACCEPTED0.01 s2details

Code

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int t;
	cin >> t;
	
	while (t--) {
		string s;
		cin >> s;

		int n = s.length();

		char b = s[0];
		bool ok = 1;
		bool ok2 = 0;
		for (char c : s) {
			if ((int)c < (int)b) {
				ok2 = 1;
				break;
			}
			if ((int)c > (int)b) ok = 0;
			if (c != b) ok2 = 1;
		}
		if (ok && !ok2) ok = 0;
		if (!ok && b == '9') {
			++n;
			b = '1';
		} else if (!ok) b = (char)((int)b + 1);

		for (int i = 0; i < n; ++i) cout << b;
		cout << '\n';
	}
}

Test details

Test 1

Group: 1, 2

Verdict: ACCEPTED

input
1000
1
2
3
4
...

correct output
2
3
4
5
6
...

user output
2
3
4
5
6
...

Test 2

Group: 2

Verdict: ACCEPTED

input
1000
735425311146082632
756615631808964686
466489470801941584
100417544394053220
...

correct output
777777777777777777
777777777777777777
555555555555555555
111111111111111111
555555555555555555
...

user output
777777777777777777
777777777777777777
555555555555555555
111111111111111111
555555555555555555
...