CSES - Datatähti Open 2021 - Results
Submission details
Task:Greater Integers
Sender:oleh1421
Submission time:2021-01-30 14:42:35 +0200
Language:C++ (C++11)
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 'void solve()':
input/code.cpp:20:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while (i<v.size() && v[i]==v[0]) i++;
            ~^~~~~~~~~
input/code.cpp:21:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (i<v.size() && v[i]>v[0]) v[0]++;
         ~^~~~~~~~~
input/code.cpp:22:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i=1;i<=v.size();i++) cout<<v[0];
                  ~^~~~~~~~~~

Code

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx")
#include <bits/stdc++.h>
typedef long long ll;
#define endl '\n'
using namespace std;
const int N=101019;

void solve(){
    ll n;cin>>n;
    n++;
    vector<int>v;
    while (n){
        v.push_back(n%10);
        n/=10;
    }
    reverse(v.begin(),v.end());
    int i=0;
    while (i<v.size() && v[i]==v[0]) i++;
    if (i<v.size() && v[i]>v[0]) v[0]++;
    for (int i=1;i<=v.size();i++) cout<<v[0];
    cout<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int tt;cin>>tt;
    while (tt--){
        solve();
    }
    return 0;
}

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