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

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:16:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(ysit == s.size()){
      ~~~~~^~~~~~~~~~~
input/code.cpp:17:13: warning: unused variable 'u' [-Wunused-variable]
    for(auto u : ve){
             ^
input/code.cpp:27:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int i = 0; i < ve.size()-1; i++){
                   ~~^~~~~~~~~~~~~
input/code.cpp:29:15: warning: unused variable 'u' [-Wunused-variable]
      for(auto u : ve){
               ^
input/code.cpp:36:15: warning: unused variable 'u' [-Wunused-variable]
      for(auto u : ve){
               ^
input/code.cpp:43:15: warning: unused variable 'u' [-Wunused-variable]
      for(auto u : ve){
               ^
input/code.cpp:52:14: warning: unused variable 'u' [-Wunused-variable]
     for(auto u : ve){
              ^

Code

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

int main(){
	int t;
	cin >> t;
	while(t--){
		string s;
		cin >> s;
		int ysit = 0;
		vector<int> ve = {};
		for(auto u : s){
			ve.push_back(u-'0');
			if(u == '9') ysit += 1;
		}
		if(ysit == s.size()){
			for(auto u : ve){
				cout << 1;
			}
			cout << 1 << "\n";
		}
		else if(s.size() == 1){
			if(s == "9") cout << "11\n";
			else cout << ve[0]+1 << "\n";
		}else{
			bool bo = false;
			for(int i = 0; i < ve.size()-1; i++){
				if(ve[0] > ve[1]){
					for(auto u : ve){
						cout << ve[0];
					}
					cout << "\n",
					bo = true;
					break;
				}else if(ve[i+1] < ve[i]){
					for(auto u : ve){
						cout << ve[0];
					}
					cout << "\n",
					bo = true;
					break;
				}else if(ve[i+1] > ve[i]){
					for(auto u : ve){
						cout << ve[0]+1;
					}
					cout << "\n",
					bo = true;
					break;
				}
			}
			if(bo == false){
				for(auto u : ve){
					cout << ve[0]+1;
				}
				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
...
Truncated

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
55555555555555
...
Truncated