CSES - Datatähti Open 2021 - Results
Submission details
Task:Greater Integers
Sender:Nagibator228
Submission time:2021-01-31 10:58:30 +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 'int main()':
input/code.cpp:50:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (ll i = 0; i < n.size(); ++i) s += n[0];
                        ~~^~~~~~~~~~
input/code.cpp:52:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (ll i = 0; i < n.size(); ++i)
                        ~~^~~~~~~~~~

Code

#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize ("trapv")
//#pragma GCC optimize ("O3")
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,avx,sse4.1,sse4.2,mmx")
typedef long long ll;
#define ff first
#define what(x) cerr << #x << " = " << x << '\n'
#define ss second
#define pb push_back
#define ld long double
#define ins insert
#define boost ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define MOD 1000000007
using namespace std;
mt19937_64 mt_rnd_64(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l, int r){
return mt_rnd_64() % (r - l + 1) + l;
}
using namespace __gnu_pbds;
template<class T>
using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
template<class T>
using ordered_multiset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;
const ll N = 1e6 + 10;
const ll inf = 1e18 + 10;
signed main()
{
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
ll q;
cin >> q;
while (q--)
{
string n;
cin >> n;
string s;
for (ll i = 0; i < n.size(); ++i) s += n[0];
ll t = 0;
for (ll i = 0; i < n.size(); ++i)
{
if (s[i] > n[i])
{
t = 1;
break;
}
else if (s[i] < n[i])
{
t = 0;
break;
}
}
if (t) cout << s;
else if (n[0] == '9') for (ll i = 0; i <= (ll)n.size(); ++i) cout << 1;
else
{
char x = n[0] + 1;
for (ll i = 0; i < (ll)n.size(); ++i) cout << x;
}
cout << '\n';
}
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