Task: | Greater Integers |
Sender: | zscoder |
Submission time: | 2021-01-30 09:15:15 +0200 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 35 |
#2 | ACCEPTED | 65 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.01 s | 1, 2 | details |
#2 | ACCEPTED | 0.01 s | 2 | details |
Code
#include <bits/stdc++.h>#include <ext/pb_ds/assoc_container.hpp>#include <ext/pb_ds/tree_policy.hpp>using namespace std;using namespace __gnu_pbds;#define fi first#define se second#define mp make_pair#define pb push_back#define fbo find_by_order#define ook order_of_keytypedef long long ll;typedef pair<int,int> ii;typedef vector<int> vi;typedef long double ld;typedef pair<ld,ld> state;typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;vector<ll> vec;void solve(){ll x; cin>>x;int lb=upper_bound(vec.begin(),vec.end(),x)-vec.begin();cout<<vec[lb]<<'\n';}ll num(int d, int t){ll ans=0;for(int i=0;i<t;i++){ans*=10; ans+=d;}return ans;}int main(){ios_base::sync_with_stdio(0); cin.tie(0);int t; cin>>t;for(int t=1;t<=18;t++){for(int d=1;d<=9;d++) vec.pb(num(d,t));}vec.pb(num(1,19));while(t--) solve();}
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 |