| Task: | Greater Integers |
| Sender: | teehandsome |
| Submission time: | 2021-01-31 16:26:02 +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.02 s | 2 | details |
Compiler report
input/code.cpp: In member function 'bool dt::operator<(const dt&)':
input/code.cpp:40:5: warning: control reaches end of non-void function [-Wreturn-type]
}
^Code
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define endl '\n'
#define INF 1e9+7
#define all(x) x.begin(),x.end()
using namespace std;
using namespace __gnu_pbds;
using ll=long long;
using pii=pair<int,int>;
using ppi=pair<int,pii>;
using oset=tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>;
template<typename T>
void _print(vector<T> x) {cerr<<"{"; for(auto e:x) cerr<<e<<","; cerr<<"}";}
void _print(pii x) {cerr<<"{"<<x.first<<","<<x.second<<"}";}
template<typename T>
void _print(T x) {cerr<<x;}
void dbg() {cerr<<endl;}
template<typename Head,typename... Tail>
void dbg(Head H,Tail... T) {
_print(H);
if(sizeof...(T)) cerr<<",";
else cerr<<"\"]";
dbg(T...);
}
#define debug(...) cerr<<"["<<#__VA_ARGS__<<"]:[\"",dbg(__VA_ARGS__)
struct dt {
string s;
bool operator<(const dt &r) {
string s2=r.s;
int m=s.size(),n=s2.size();
if(m!=n) return m<n;
for(int i=0;i<m;i++) {
if(s[i]==s2[i]) continue;
return s[i]<s2[i];
}
}
bool operator==(const dt &r) {
string s2=r.s;
return s==s2;
}
};
dt gen(int x,dt s) {
dt res;
while(res<s or res==s) res.s.push_back(x+'0');
return res;
}
int main () {
ios::sync_with_stdio(false); cin.tie(0);
int t; cin>>t;
while(t--) {
dt s; cin>>s.s;
vector<dt> a;
for(int i=1;i<=9;i++) {
a.push_back(gen(i,s));
}
cout<<min_element(all(a))->s<<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: ACCEPTED
| input |
|---|
| 1000 735425311146082632 756615631808964686 466489470801941584 100417544394053220 ... |
| correct output |
|---|
| 777777777777777777 777777777777777777 555555555555555555 111111111111111111 555555555555555555 ... |
| user output |
|---|
| 777777777777777777 777777777777777777 555555555555555555 111111111111111111 55555555555555 ... Truncated |
