QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#767567#9271. Easy MoneyN_z_AC ✓47ms3824kbC++236.6kb2024-11-20 21:17:022024-11-20 21:17:04

Judging History

你现在查看的是最新测评结果

  • [2024-11-20 21:17:04]
  • 评测
  • 测评结果:AC
  • 用时:47ms
  • 内存:3824kb
  • [2024-11-20 21:17:02]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
struct time_helper{
#ifdef LOCAL
clock_t time_last;time_helper(){time_last=clock();}void test(){auto time_now=clock();std::cerr<<"time:"<<1.*(time_now-time_last)/CLOCKS_PER_SEC<<";all_time:"<<1.*time_now/CLOCKS_PER_SEC<<std::endl;time_last=time_now;}~time_helper(){test();}
#else
void test(){}
#endif
}time_helper;
#ifdef LOCAL
#include"dbg.h"
#else
#define dbg(...) (__VA_ARGS__)
#endif
namespace Fread{const int SIZE=1<<16;char buf[SIZE],*S,*T;inline char getchar(){if(S==T){T=(S=buf)+fread(buf,1,SIZE,stdin);if(S==T)return'\n';}return *S++;}}namespace Fwrite{const int SIZE=1<<16;char buf[SIZE],*S=buf,*T=buf+SIZE;inline void flush(){fwrite(buf,1,S-buf,stdout);S=buf;}inline void putchar(char c){*S++=c;if(S==T)flush();}struct NTR{~NTR(){flush();}}ztr;}
#define getchar Fread::getchar
#define putchar Fwrite::putchar
int print_precision=10;bool print_T_endl=1;char print_between=' ';
template<typename T>struct is_char{static constexpr bool value=(std::is_same<T,char>::value||std::is_same<T,signed char>::value||std::is_same<T,unsigned char>::value);};template<typename T>struct is_integral_ex{static constexpr bool value=(std::is_integral<T>::value||std::is_same<T,__int128>::value)&&!is_char<T>::value;};template<typename T>struct is_floating_point_ex{static constexpr bool value=std::is_floating_point<T>::value||std::is_same<T,__float128>::value;};namespace Fastio{struct Reader;struct Writer;template<size_t id>struct read_tuple{template<typename...T>static void read(Reader&stream,std::tuple<T...>&x){read_tuple<id-1>::read(stream,x);stream>>get<id-1>(x);}};template<>struct read_tuple<0>{template<typename...T>static void read([[maybe_unused]]Reader&stream,[[maybe_unused]]std::tuple<T...>&x){}};template<size_t id>struct print_tuple{template<typename...T>static void print(Writer&stream,const std::tuple<T...>&x){print_tuple<id-1>::print(stream,x);putchar(print_between);stream<<get<id-1>(x);}};template<>struct print_tuple<1>{template<typename...T>static void print(Writer&stream,const std::tuple<T...>&x){stream<<get<0>(x);}};template<>struct print_tuple<0>{template<typename...T>static void print([[maybe_unused]]Writer&stream,[[maybe_unused]]const std::tuple<T...>&x){}};
struct Reader{template<typename T>typename std::enable_if_t<std::is_class<T>::value,Reader&>operator>>(T&x){for(auto &y:x)*this>>y;return *this;}template<typename...T>Reader&operator>>(std::tuple<T...>&x){read_tuple<sizeof...(T)>::read(*this,x);return *this;}template<typename T>typename std::enable_if_t<is_integral_ex<T>::value,Reader&>operator>>(T&x){char c=getchar();short f=1;while(c<'0'||c>'9'){if(c=='-')f*=-1;c=getchar();}x=0;while(c>='0'&&c<='9'){x=(x<<1)+(x<<3)+(c^48);c=getchar();}x*=f;return *this;}template<typename T>typename std::enable_if_t<is_floating_point_ex<T>::value,Reader&>operator>>(T&x){char c=getchar();short f=1,s=0;x=0;T t=0;while((c<'0'||c>'9')&&c!='.'){if(c=='-')f*=-1;c=getchar();}while(c>='0'&&c<='9'&&c!='.')x=x*10+(c^48),c=getchar();if(c=='.')c=getchar();else return x*=f,*this;while(c>='0'&&c<='9')t=t*10+(c^48),s++,c=getchar();while(s--)t/=10.0;x=(x+t)*f;return*this;}template<typename T>typename std::enable_if_t<is_char<T>::value,Reader&>operator>>(T&c){c=getchar();while(c=='\n'||c==' '||c=='\r')c=getchar();return *this;}Reader&operator>>(char*str){int len=0;char c=getchar();while(c=='\n'||c==' '||c=='\r')c=getchar();while(c!='\n'&&c!=' '&&c!='\r')str[len++]=c,c=getchar();str[len]='\0';return*this;}template<typename T1,typename T2>Reader&operator>>(std::pair<T1,T2>&x){*this>>x.first>>x.second;return *this;}Reader&operator>>(std::string&str){str.clear();char c=getchar();while(c=='\n'||c==' '||c=='\r')c=getchar();while(c!='\n'&&c!=' '&&c!='\r')str.push_back(c),c=getchar();return*this;}Reader(){}}cin;const char endl='\n';
struct Writer{typedef __int128 mxdouble;template<typename T>typename std::enable_if_t<std::is_class<T>::value,Writer&>operator<<(const T&x){for(auto q:x){*this<<q;if(!is_class<decltype(q)>::value)*this<<print_between;}if(!is_class<typename T::value_type>::value&&print_T_endl)*this<<'\n';return *this;}template<typename...T>Writer&operator<<(const std::tuple<T...>&x){print_tuple<sizeof...(T)>::print(*this,x);if(print_T_endl)*this<<'\n';return *this;}template<typename T>typename std::enable_if_t<is_integral_ex<T>::value,Writer&>operator<<(T x){if(x==0)return putchar('0'),*this;if(x<0)putchar('-'),x=-x;static int sta[45];int top=0;while(x)sta[++top]=x%10,x/=10;while(top)putchar(sta[top]+'0'),--top;return*this;}template<typename T>typename std::enable_if_t<is_floating_point_ex<T>::value,Writer&>operator<<(T x){if(x<0)putchar('-'),x=-x;x+=pow(10,-print_precision)/2;mxdouble _=x;x-=(T)_;static int sta[45];int top=0;while(_)sta[++top]=_%10,_/=10;if(!top)putchar('0');while(top)putchar(sta[top]+'0'),--top;putchar('.');for(int i=0;i<print_precision;i++)x*=10;_=x;while(_)sta[++top]=_%10,_/=10;for(int i=0;i<print_precision-top;i++)putchar('0');while(top)putchar(sta[top]+'0'),--top;return*this;}template<typename T>typename std::enable_if_t<is_char<T>::value,Writer&>operator<<(const T&c){putchar(c);return*this;}Writer&operator<<(char*str){int cur=0;while(str[cur])putchar(str[cur++]);return *this;}Writer&operator<<(const char*str){int cur=0;while(str[cur])putchar(str[cur++]);return*this;}template<typename T1,typename T2>Writer&operator<<(const std::pair<T1,T2>&x){*this<<x.first<<print_between<<x.second;if(print_T_endl)*this<<'\n';return *this;}Writer&operator<<(const std::string&str){int st=0,ed=str.size();while(st<ed)putchar(str[st++]);return*this;}Writer(){}}cout;}
#define cin Fastio::cin
#define cout Fastio::cout
#define endl Fastio::endl
template<class Fun>class y_combinator_result{Fun fun_;public:template<class T>explicit y_combinator_result(T &&fun): fun_(std::forward<T>(fun)) {}template<class ...Args>decltype(auto) operator()(Args &&...args){return fun_(std::ref(*this), std::forward<Args>(args)...);}};template<class Fun>decltype(auto) y_combinator(Fun &&fun){return y_combinator_result<std::decay_t<Fun>>(std::forward<Fun>(fun));}

void init();void solve(int tc);
main()
{
	init();int t=1;
	// cin>>t;
	for(int tc=1;tc<=t;tc++)solve(tc);
}
void init()
{
}
bool chk(string s)
{
	int res=0;
	for(auto q:s)res=(res*10+q-'0')%7;
	return res==0;
}
void solve([[maybe_unused]]int tc)
{
	string s;
	cin>>s;
	sort(s.begin(),s.end());
	array<vector<int>,7>mv;
	string t;
	for(auto q:s)mv[(q-'0')%7].emplace_back(q),t+=(q-'0')%7+'0';
	reverse(t.begin(),t.end());
	string ans="-1";
	int T=10000;
	do
	{
		dbg(t);
		if(chk(t)){auto nmv=mv;string res;for(auto q:t)res+=nmv[(q-'0')%7].back(),nmv[(q-'0')%7].pop_back();ans=max(ans,res);}
	}
	while(prev_permutation(t.begin(),t.end())&&T--);
	cout<<ans<<endl;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3580kb

input:

14

output:

14

result:

ok answer is '14'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3512kb

input:

11

output:

-1

result:

ok answer is '-1'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

2020

output:

2002

result:

ok answer is '2002'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

1

output:

-1

result:

ok answer is '-1'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

4

output:

-1

result:

ok answer is '-1'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

2

output:

-1

result:

ok answer is '-1'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3728kb

input:

7

output:

7

result:

ok answer is '7'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3568kb

input:

12

output:

21

result:

ok answer is '21'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3508kb

input:

150

output:

105

result:

ok answer is '105'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

294

output:

924

result:

ok answer is '924'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

70107

output:

-1

result:

ok answer is '-1'

Test #12:

score: 0
Accepted
time: 0ms
memory: 3504kb

input:

7907

output:

-1

result:

ok answer is '-1'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3728kb

input:

10001

output:

10010

result:

ok answer is '10010'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

222221

output:

-1

result:

ok answer is '-1'

Test #15:

score: 0
Accepted
time: 0ms
memory: 3752kb

input:

999999222221

output:

-1

result:

ok answer is '-1'

Test #16:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

818181818181

output:

888888111111

result:

ok answer is '888888111111'

Test #17:

score: 0
Accepted
time: 5ms
memory: 3580kb

input:

299292999222999292292999229222299299292999222999999299999222229929292929292299222992292999922299229992292922992999999292292922299992929292999992222929922292929999929292299299992299922922222299922999999292929299922299999929999992222929222929292929292229222922929292992222992299299922999999292992992922...

output:

999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...

result:

ok answer is '999999999999999999999999999999...2222222222222222222222222122222'

Test #18:

score: 0
Accepted
time: 5ms
memory: 3588kb

input:

992299299299222929922999999929999299229222299992922229229229292229929222292922229922922922229929999292229929292922222922299229999299999299929922999999929999229999222999999229999229999292229222229999299292222299229999929222229222922999229999299222929222999999299222292999992222922922292929229929922999...

output:

-1

result:

ok answer is '-1'

Test #19:

score: 0
Accepted
time: 5ms
memory: 3420kb

input:

818181888118888111811888188888888118181181111181181818111881881818181811811118881111181118181111188188118188118111111188181188181881881111111111111818811888818118881181811181888111888118188188181111111111888181881818818118181811888818888811188188118118118881818818118118111811881818881818118881811111...

output:

889888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888...

result:

ok answer is '889888888888888888888888888888...1111111111111111111111111111111'

Test #20:

score: 0
Accepted
time: 5ms
memory: 3512kb

input:

811888818111188111188181811181181118881188888888818888188818811181181811118888111111181118811181818888811881181881111118818818888881881111888811888188111888111818881181188188181111111888811118118188188888818181118188111888181881811181181111188111181818818111181188188811811181181188188881881181111888...

output:

-1

result:

ok answer is '-1'

Test #21:

score: 0
Accepted
time: 2ms
memory: 3604kb

input:

777070007000007000777707707707070007007000700007007777000770700770070007077700770707707007070777000707770007700770777777070000077000070770707070777000770700007707770770070700007700000000700707077777777000000007077700007070077007077700000777007070707000777070007700077770777707000071070777007077007070...

output:

-1

result:

ok answer is '-1'

Test #22:

score: 0
Accepted
time: 2ms
memory: 3584kb

input:

777077000000077077000777070700070077777000000700770700077000007007070700077070000770007000070077070707077070007000007000707707770007077000707007007070007007707070077777707000777700007700700707077070707700070707700777700000077770077770700777070777770700000700700707000007700700707000700707007770007000...

output:

-1

result:

ok answer is '-1'

Test #23:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

770700700000070777000707777770777777707777007700777077077077777700770777000777770700770770700077707000000770700700770070007707070777777070007707077700777777077777077007700707770777070007707770077700070070000070070007700707007707770777007707770777077770777777070007000007770700077050707770000700707777...

output:

-1

result:

ok answer is '-1'

Test #24:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...

output:

-1

result:

ok answer is '-1'

Test #25:

score: 0
Accepted
time: 28ms
memory: 3476kb

input:

620436154163509563507919650719927952508188442784407588398637939177640354348248054810004291038561761789903334548860626608403095892847290798758572135654993008519975434571796229764177736368334992472273340855483013090697882119203723855966534418046756803623094943164349224564725971707564646549364942721091...

output:

999999999999999999999999999999999999999999999999999999999999999999999999888888888888888888888888888888888888888888888888888888888888777777777777777777777777777777777777777777777777777777766666666666666666666666666666666666666666666666666666666666666666555555555555555555555555555555555555555555555555...

result:

ok answer is '999999999999999999999999999999...0000000000000000000000000000000'

Test #26:

score: 0
Accepted
time: 12ms
memory: 3580kb

input:

2026632195728579864848543337086144016485144037992364957124010616133373548349979385940601321690346736227396154306468801983025135356587910577405071226191118056463902480285733943435796863649486033446142248545419789482268038741460162529580944283182196148155943

output:

9999999999999999999999998888888888888888888888888877777777777777777666666666666666666666666666655555555555555555555555444444444444444444444444444444444444333333333333333333333333333333322222222222222222222221111111111111111111111111100000100000000000000000

result:

ok answer is '999999999999999999999999888888...1111111100000100000000000000000'

Test #27:

score: 0
Accepted
time: 2ms
memory: 3564kb

input:

3705255268646647136740457288734914

output:

9888777776666655554444443332221100

result:

ok answer is '9888777776666655554444443332221100'

Test #28:

score: 0
Accepted
time: 26ms
memory: 3512kb

input:

997986450667534848291538102850942565459984588654558321057364019277059779248703457352893163205754797977823376986820483190408495990397990369073265782324170662269019757473000751679570121713999533007929528930528896597902379121870414769214948061255490431051607453678636427224695419541935711553855496837274...

output:

999999999999999999999999999999999999999999999999999999999999999999999999988888888888888888888888888888888888888888888888888888888888777777777777777777777777777777777777777777777777777777777777777776666666666666666666666666666666666666666666655555555555555555555555555555555555555555555555555555555555...

result:

ok answer is '999999999999999999999999999999...0000000000000000000000000000000'

Test #29:

score: 0
Accepted
time: 12ms
memory: 3516kb

input:

6576048032171095208078956765910980567803215448368626985542818300431772997950624798197486134379859700138057824898351952659383578838586523039186675636844293191045771527730045937374807063134788312147589555093720576202418450374422202139564718966242425

output:

9999999999999999999999988888888888888888888888888888877777777777777777777777777776666666666666666666665555555555555555555555555555544444444444444444444444333333333333333333333333322222222222222222222222111111111111111111101000000000000000000000000

result:

ok answer is '999999999999999999999998888888...1111101000000000000000000000000'

Test #30:

score: 0
Accepted
time: 42ms
memory: 3524kb

input:

489196270915370824783160303094312338815078401366258039297545809168786099770140355416838020058055064231620732185288939005536678509506924179430108949085285118104120481875523952202109354101875247122063727470917469549502600279756476212316836665810840026777305106015567979105345025459392602134214754794178...

output:

999999999999999999999999999999999999999999999999999999999999999999999999999999999999988888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888877777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777666666666666666...

result:

ok answer is '999999999999999999999999999999...0000000000000000000000000000000'

Test #31:

score: 0
Accepted
time: 20ms
memory: 3584kb

input:

962836421201452777322426371780496517858052110963437517942109757186646394331608511701281979334456861726746120604899559488055555213101010979637281212959828358325376064869406279398051917424858366306025370141889543351253215896374119321940709786950972285575444120414301609111642399362570929914225151700248...

output:

999999999999999999999999999999999999999999888888888888888888888888888888888888888887777777777777777777777777777777777777777776666666666666666666666666666666665555555555555555555555555555555555555555555555555544444444444444444444444444444444444444444444444444333333333333333333333333333333333333333333...

result:

ok answer is '999999999999999999999999999999...0000000000000000000000000000000'

Test #32:

score: 0
Accepted
time: 25ms
memory: 3544kb

input:

978306889353099225469375690026173343180298633565539062166053191755618086213787625944137665729276887051948526179563560169528179631648039163245777106798174750263631819192729553699542350279091719601153053010557329294735457904118503433640647131790286278223893385988551068752221214648711538886201029483715...

output:

999999999999999999999999999999999999999999999999999999999998888888888888888888888888888888888888888888888888877777777777777777777777777777777777777777777777777777777777776666666666666666666666666666666666666666666666666666666666666655555555555555555555555555555555555555555555555555554444444444444444...

result:

ok answer is '999999999999999999999999999999...0000000000000000000000000000000'

Test #33:

score: 0
Accepted
time: 25ms
memory: 3508kb

input:

161615893002333073609615149196721394228472267098728101439695183478004690878987780203971230496446266888806772295444776679328451544649840037358404575491645713730992477714720187759426724773055884699838176157546282541057532765343891739109925875869976283417193490339866389199625815734497531219086200641398...

output:

999999999999999999999999999999999999999999999999999999999999999999999888888888888888888888888888888888888888888888888888888887777777777777777777777777777777777777777777777777777777777777777776666666666666666666666666666666666666666666666555555555555555555555555555555555555555555555554444444444444444...

result:

ok answer is '999999999999999999999999999999...0000000000000000000000000000000'

Test #34:

score: 0
Accepted
time: 14ms
memory: 3580kb

input:

928339282427591086595583394278857732044482099233020196926505607741950378951469158964763630108810296266537832934124056551895334711599953666258078267610006916484018205148056106238681576996595604270121725322620947109923009250373455256996941321738887343007039627928046050955423017575077183686529135633776...

output:

999999999999999999999999999999999999999999988888888888888888888888888888888888888777777777777777777777777777777777666666666666666666666666666666666666666555555555555555555555555555555555555555555555544444444444444444444444444444333333333333333333333333333333333333222222222222222222222222222222222222...

result:

ok answer is '999999999999999999999999999999...0000000000000000000000000000000'

Test #35:

score: 0
Accepted
time: 43ms
memory: 3616kb

input:

295383883493312820532852153882640929509250129113080094534691943542239076259889684912390750672731988071270081673587321780717472406186750471252849721166189671906815500977323114634077470432231941562797882516387727804371857824476201153452171507718831951794638047632893576418415203315314808344135775520619...

output:

999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888887777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777...

result:

ok answer is '999999999999999999999999999999...0000000000000000000000000000000'

Test #36:

score: 0
Accepted
time: 5ms
memory: 3752kb

input:

89377001784559046428341127028535623714887946226631479730970310793167622010035112121789733820301693843574017

output:

99999999888888888777777777777777666666665555554444444443333333333333322222222222111111111111101000000000000

result:

ok answer is '999999998888888887777777777777...2222111111111111101000000000000'

Test #37:

score: 0
Accepted
time: 37ms
memory: 3584kb

input:

823395140304400292215758868836002844266712495444994350954955774440284327006914270007247558861317859477156340099879950257310430912927199332410614317197261934512773510381231440442902901041707670209286673245323092930640333219908986691471777276711884351995756060806384280861373825105189505989824739797002...

output:

999999999999999999999999999999999999999999999999999999999999999999999999999999999998888888888888888888888888888888888888888888888888888888888888888888888877777777777777777777777777777777777777777777777777777777777777777777777777766666666666666666666666666666666666666666666666666666666666666666666666...

result:

ok answer is '999999999999999999999999999999...0000000000000000000000000000000'

Test #38:

score: 0
Accepted
time: 37ms
memory: 3616kb

input:

645479788669184035907765444808931179507392308542692271137399873283288763622066006465277218531122253176235984656611513953464984949606130587601185503926727391733237090777299348250824421524159676888284567618469612816995604667820008408286666821641195925285141556835317803507388700127503685254517509673053...

output:

999999999999999999999999999999999999999999999999999999999999999999999999999999999999988888888888888888888888888888888888888888888888888888888888888888888888888888888888888888877777777777777777777777777777777777777777777777777777777777777777777776666666666666666666666666666666666666666666666666666666...

result:

ok answer is '999999999999999999999999999999...0000000000000000000000000000000'

Test #39:

score: 0
Accepted
time: 42ms
memory: 3816kb

input:

404518776137841027043545348960583182629879714714413611043479627363405708373253490615514756265547090922780936665385282215181558228722970682623920858231826480044449605769375271840613300392443508268473973900357254309481297792085489378842403662315094115117383677509440025178040112683680797302665301006177...

output:

999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777766666666...

result:

ok answer is '999999999999999999999999999999...0000000000000000000000000000000'

Test #40:

score: 0
Accepted
time: 11ms
memory: 3584kb

input:

746095388372146697972983600204131365418727001389496606459004847995299053087876825116467437421832841888290527195723054331641009081560389249502403001115870986103342395664014262786628778747618547855192526965933940449938750744062410244998320538757673

output:

999999999999999999999999998888888888888888888888888877777777777777777777777776666666666666666666666665555555555555555555554444444444444444444444444444433333333333333333333333222222222222222222222211111111111111111111000001000000000000000000000000

result:

ok answer is '999999999999999999999999998888...1000001000000000000000000000000'

Test #41:

score: 0
Accepted
time: 33ms
memory: 3824kb

input:

436896323409410837509742296580456528786587475221252590456500691835304341110629740091106070438026077787240769510267377970584866098801647232760230138607069059674220500849219311671178050484871632048387313745849702575789741211175235087107820002855022289778249720721176345933052981183320920505252420892393...

output:

999999999999999999999999999999999999999999999999999999998888888888888888888888888888888888888888888888888888888888888888888888888888887777777777777777777777777777777777777777777777777777777777777777777777766666666666666666666666666666666666666666666666666666666666666666666665555555555555555555555555...

result:

ok answer is '999999999999999999999999999999...0000000000000000000000000000000'

Test #42:

score: 0
Accepted
time: 4ms
memory: 3572kb

input:

2520425012092091419638742417645313106843367405788961717056584860137009484798829687853367

output:

9999999888888888887777777777666666666555555544444444443333333322222221111111100100000000

result:

ok answer is '999999988888888888777777777766...3333322222221111111100100000000'

Test #43:

score: 0
Accepted
time: 2ms
memory: 3752kb

input:

8888887777777777771000000000

output:

8888878777777777770000100000

result:

ok answer is '8888878777777777770000100000'

Test #44:

score: 0
Accepted
time: 0ms
memory: 3788kb

input:

97888888

output:

89788888

result:

ok answer is '89788888'

Test #45:

score: 0
Accepted
time: 0ms
memory: 3564kb

input:

92888888

output:

89888288

result:

ok answer is '89888288'

Test #46:

score: 0
Accepted
time: 0ms
memory: 3464kb

input:

41222222

output:

24222212

result:

ok answer is '24222212'

Test #47:

score: 0
Accepted
time: 0ms
memory: 3752kb

input:

90111111

output:

19011111

result:

ok answer is '19011111'

Test #48:

score: 0
Accepted
time: 0ms
memory: 3752kb

input:

60333333

output:

36033333

result:

ok answer is '36033333'

Test #49:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

59888888

output:

89858888

result:

ok answer is '89858888'

Test #50:

score: 0
Accepted
time: 0ms
memory: 3512kb

input:

298700000

output:

978000002

result:

ok answer is '978000002'

Test #51:

score: 0
Accepted
time: 0ms
memory: 3800kb

input:

918000000

output:

908000100

result:

ok answer is '908000100'

Test #52:

score: 0
Accepted
time: 0ms
memory: 3520kb

input:

200777777

output:

-1

result:

ok answer is '-1'

Test #53:

score: 0
Accepted
time: 43ms
memory: 3584kb

input:

888888888888888888888888888888888888888088788888888888888887888888888888788888888888888888888888880888888888888888888880088808888888888888888888888888888888888888888888888888888888888888888888888888888887888888888888888888888888888808888888888888888088888888888888888888888888888888888888888888888887...

output:

888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888...

result:

ok answer is '888888888888888888888888888888...8777777777777777777700030000000'

Test #54:

score: 0
Accepted
time: 45ms
memory: 3484kb

input:

878887808880778808078077877708778080888788800888888778000708888888808878888088880788088808888078000877880888787088888007878788780785087788080708877088800887008888080788888777888880887888887788008880888780880787880088888878088870808887777788808888880870878807007877808888808788878877807888888887888080...

output:

888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888...

result:

ok answer is '888888888888888888888888888888...0000000000000000000000000000000'

Test #55:

score: 0
Accepted
time: 46ms
memory: 3644kb

input:

999991919911899998119811998111188991181899198988811919999111889118819999988119988899918911998891189898198811899111199198999989189891811989919819989999819998999988988899111199919188999189188189881198988899988881898889818199881198189891981998119891811899819818199191889899819989998111819998898919118891...

output:

999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...

result:

ok answer is '999999999999999999999999999999...1111111111111111111111111111111'

Test #56:

score: 0
Accepted
time: 47ms
memory: 3616kb

input:

988181988811818998918111111119811898898181888118898818911191819898911188119918911198919881189918891819989891818119919881118881881899118888898811811899199889111918119118181181119988988189891818188111888819911871111181818818189881198111898819919911181819119119199188818811988898811918881188191118888981...

output:

999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999989888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888...

result:

ok answer is '999999999999999999999999999999...1111111111111111111111111111111'

Test #57:

score: 0
Accepted
time: 46ms
memory: 3744kb

input:

808780088878780777008088708008778078087700787870700078878787878000888777878877788878070707708008087708777777788077000808088700080780888700007700870807800880807808070708080887087077777887077008000770777000807787808000008888777700887870700880808078807008807870077708070700800800700008800778770878807877...

output:

888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888...

result:

ok answer is '888888888888888888888888888888...0000000000000000000000000000000'

Test #58:

score: 0
Accepted
time: 47ms
memory: 3528kb

input:

777777077870770007077700077778777777007700070077700070700007000700000008077070777077700007707007070077070808777777777007807707077070007700700077777707770708777000707778000777077000070007780070700777770777777000700070000700770770070070077770000707000707700008007007000077007770077007770077070777777700...

output:

888888888888888888888888888888888887877777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777...

result:

ok answer is '888888888888888888888888888888...0000000000000000000000000000000'

Test #59:

score: 0
Accepted
time: 43ms
memory: 3516kb

input:

898111888881988811888811188811881111881911881811918111818118191881911919891888189111191811118111888881818119811188181118199188881181111198818818111811118881198998199888118189819181891118188918189188119889888818981119118111118191198888181118888818811181188118111918981998889881111881988888889111881181...

output:

999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999989888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888...

result:

ok answer is '999999999999999999999999999999...1111111111111111111111111111111'

Test #60:

score: 0
Accepted
time: 47ms
memory: 3804kb

input:

777777777777777777777777777777777777777777777777777777778777777777777777877777777777777777777777877777777777707777777777777777777777777777777777777788777777778777777777777777777777777777077777777777777777777777777787877777777777777777777777877777787777777777777777777777777777777777777077777777777777...

output:

888888888888888888888888888888888887877777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777...

result:

ok answer is '888888888888888888888888888888...7777777777777777777001000000000'

Test #61:

score: 0
Accepted
time: 47ms
memory: 3740kb

input:

111111111111111111111111111111111118111111111111111111111111111111111111111811111111111111111111111111111111111119111111111111111111111111811111111111911111111111191191111118111111111111111111111111111111111111111111111111111111111111811111111111111111111111111111111111111111111111111111111111111111...

output:

999999999999999989888888888888888888881141111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok answer is '999999999999999989888888888888...1111111111111111111111111111111'

Extra Test:

score: 0
Extra Test Passed