CSES - Datatähti Open 2021 - Results
Submission details
Task:Greater Integers
Sender:Black_hat
Submission time:2021-01-30 07:38:18 +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:40:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(i=0;i<vc.size();i++){
           ~^~~~~~~~~~
input/code.cpp:45:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    while(i<vc.size()){
          ~^~~~~~~~~~
input/code.cpp:49:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   else if(i<vc.size()){
           ~^~~~~~~~~~
input/code.cpp:50:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    while(i<vc.size()){
          ~^~~~~~~~~~
input/code.cpp:55:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(i=0;i<=vc.size();i++){
            ~^~~~~~~~~~~
input/code.cpp:32:8: warning: unused variable 'j' [-Wunused-variable]
   ll i,j,k,l,n;
        ^
input/code.cpp:32:12: warning: unused variable 'l' [-Wunused-variable]...

Code

#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 100005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//----------------------------------------------
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	int t;
	cin>>t;
	while(t--){
		ll i,j,k,l,n;
		cin>>n;
		vector<ll> vc;
		k=n;
		while(k>0){
			vc.ps(k%10);
			k=k/10;
		}reverse(all(vc));
		for(i=0;i<vc.size();i++){
			if(vc[i]!=9) break;
		}
		if(i==0){
			k=vc[i]+1;
			while(i<vc.size()){
				cout<<k; i++;
			}cout<<endl;
		}
		else if(i<vc.size()){
			while(i<vc.size()){
				cout<<"9"; i++;
			}cout<<endl;
		}
		else{
			for(i=0;i<=vc.size();i++){
				cout<<"1";
			}cout<<endl;
		}
	}
	return 0;
}

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