CSES - Datatähti Open 2021 - Results
Submission details
Task:Greater Integers
Sender:vishesh312
Submission time:2021-01-30 16:51:51 +0200
Language:C++ (C++17)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED35
#2ACCEPTED65
Test results
testverdicttimegroup
#1ACCEPTED0.01 s1, 2details
#2ACCEPTED0.01 s2details

Code

#include "bits/stdc++.h"
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
*/
#define all(x) begin(x), end(x)
#define sz(x) (int)x.size()
typedef long long ll;
#define int ll
const int mod = 1e9+7;
void solve(int tc) {
string s;
cin >> s;
stringstream ss(s);
int num;
ss >> num;
int n = sz(s);
string a = "";
string b = "";
string c = "";
for (int i = 0; i < n; ++i) a += s[0];
for (int i = 0; i < n; ++i) b += (s[0] + 1);
for (int i = 0; i < n+1; ++i) c += ('1');
stringstream sa(a), sb(b), sc(c);
int x[3];
sa >> x[0];
sb >> x[1];
sc >> x[2];
sort(x, x+3);
for (int i = 0; i < 3; ++i) {
if (x[i] > num) {
cout << x[i] << '\n';
return;
}
}
}
signed main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
int tc = 1;
cin >> tc;
for (int i = 1; i <= tc; ++i) solve(i);
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