Task: | Greater Integers |
Sender: | Kesatria_Komodo |
Submission time: | 2021-01-31 00:03:48 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 35 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 35 |
#2 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.01 s | 1, 2 | details |
#2 | WRONG ANSWER | 0.01 s | 2 | details |
Code
#include <iostream> #include <cstdio> #include <vector> #include <queue> #include <fstream> #include <sstream> #include <bitset> #include <cassert> #include <functional> #include <cstring> #include <ctime> #include <cmath> #include <set> #include <map> #include <algorithm> #define sec second #define fir first #define pb push_back #define mp make_pair #define REP(i , n) for (int i = 0 ; i < (n) ; i++) #define BACK(i , n) for (int i = (n) - 1 ; i >= 0 ; i--) using namespace std; using vi = vector<int>; using vii = vector<vi>; using pii = pair<int , int>; using ll = long long; using ld = long double; const int MAX = 1e9 , MIN = - MAX , MOD = 1e9 + 7; const ll MAX_LL = 1e18 , MIN_LL = -MAX_LL; int main(){ int T; cin >> T; vector<ll> vec; for (int sz = 1 ; sz <= 18 ; ++sz) for (char i = '1' ; i <= '9' ; ++i){ ll now; stringstream(string(sz , i)) >> now; vec.push_back(now); } while(T--){ ll z; cin >> z; auto it = lower_bound(begin(vec) , end(vec) , z); cout << (*it == z ? *(it + 1) : *it) << endl; } }
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: WRONG ANSWER
input |
---|
1000 735425311146082632 756615631808964686 466489470801941584 100417544394053220 ... |
correct output |
---|
777777777777777777 777777777777777777 555555555555555555 111111111111111111 555555555555555555 ... |
user output |
---|
777777777777777777 777777777777777777 555555555555555555 111111111111111111 55555555555555 ... Truncated |