CSES - Datatähti 2021 loppu - Results
Submission details
Task:Suuremmat
Sender:intoo
Submission time:2022-01-18 23:08:55 +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:16:14: warning: unused variable '_' [-Wunused-variable]
    for (auto _ : s) cout << char(s[0]+1);
              ^
input/code.cpp:18:14: warning: unused variable '_' [-Wunused-variable]
    for (auto _ : s) cout << s[0];
              ^
input/code.cpp:21:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i <= s.size(); ++i)
                     ~~^~~~~~~~~~~
input/code.cpp:24:15: warning: unused variable '_' [-Wunused-variable]
     for (auto _ : s) cout << char(s[0]+1);
               ^

Code

#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int t;
	cin >> t;
	while (t --> 0) {
		string s;
		cin >> s;
		int mi = *min_element(s.begin(), s.end());
		int ma = *max_element(s.begin(), s.end());
		if (ma > s[0]) {
			for (auto _ : s) cout << char(s[0]+1);
		} else if (mi < s[0]) {
			for (auto _ : s) cout << s[0];
		} else {
			if (s[0] == '9') {
				for (int i = 0; i <= s.size(); ++i)
					cout << 1;
			} else {
				for (auto _ : s) cout << char(s[0]+1);
			}
		}
		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
888888888888888888
888888888888888888
555555555555555555
222222222222222222
55555555555555
...
Truncated