QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#782239 | #9641. Two permutations | N_z_ | 100 ✓ | 383ms | 27292kb | C++23 | 6.8kb | 2024-11-25 19:27:11 | 2024-11-25 19:27:11 |
Judging History
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()
{
}
void solve([[maybe_unused]]int tc)
{
int n;
cin>>n;
vector<int>v(n+1);
for(int x=1;x<=n;x++)
cin>>v[x];
for(int x=1;x<=n;x++)
if(v[x]>x){cout<<"No"<<endl;return;}
vector<vector<int>>v1(n+1),v2(n+1);
vector<int>now(n+1);
for(int x=1;x<=n;x++)
if(v[x]==x)v1[x].emplace_back(x),v2[x].emplace_back(x);
else
{
now[x]=now[v[x]]^1;
if(now[x]==0)v1[v[x]].emplace_back(x),v2[x].emplace_back(x);
else v1[x].emplace_back(x),v2[v[x]].emplace_back(x);
}
cout<<"Yes"<<endl;
for(int x=1;x<=n;x++)
{
reverse(v1[x].begin(),v1[x].end());
for(auto q:v1[x])cout<<q<<' ';
}
for(int x=1;x<=n;x++)
{
reverse(v2[x].begin(),v2[x].end());
for(auto q:v2[x])cout<<q<<' ';
}
cout<<endl;
}
详细
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 0ms
memory: 3628kb
input:
10 1 1 2 1 1 3 1 2 2 4 1 1 3 2 5 1 2 1 2 1 2 1 1 1 1 3 1 2 2 1 1 5 1 1 1 3 2
output:
Yes 1 1 Yes 1 2 2 1 Yes 1 2 3 1 3 2 Yes 1 4 2 3 2 1 3 4 Yes 1 2 3 4 5 5 3 1 4 2 Yes 1 2 2 1 Yes 1 1 Yes 1 2 3 1 3 2 Yes 1 1 Yes 1 5 2 4 3 3 2 1 4 5
result:
ok Correct!
Test #2:
score: 10
Accepted
time: 0ms
memory: 3544kb
input:
10 4 1 2 3 3 1 1 5 1 2 1 4 2 1 1 3 1 1 1 5 1 1 1 1 1 3 1 2 1 5 1 1 2 3 4 5 1 1 1 3 2 5 1 1 3 1 5
output:
Yes 1 2 3 4 1 2 4 3 Yes 1 1 Yes 1 2 3 4 5 3 1 5 2 4 Yes 1 1 Yes 1 2 3 3 2 1 Yes 1 2 3 4 5 5 4 3 2 1 Yes 1 2 3 3 1 2 Yes 1 3 2 5 4 2 1 4 3 5 Yes 1 5 2 4 3 3 2 1 4 5 Yes 1 2 3 4 5 4 2 1 3 5
result:
ok Correct!
Test #3:
score: 10
Accepted
time: 0ms
memory: 3772kb
input:
10 5 1 2 3 4 5 5 1 1 2 3 4 5 1 2 2 3 4 5 1 1 3 2 5 5 1 1 1 1 1 5 1 2 3 4 4 5 1 2 2 2 2 5 1 1 1 2 3 5 1 2 1 2 1 5 1 2 1 2 2
output:
Yes 1 2 3 4 5 1 2 3 4 5 Yes 1 3 2 5 4 2 1 4 3 5 Yes 1 2 4 3 5 1 3 2 5 4 Yes 1 4 2 3 5 2 1 3 4 5 Yes 1 2 3 4 5 5 4 3 2 1 Yes 1 2 3 4 5 1 2 3 5 4 Yes 1 2 3 4 5 1 5 4 3 2 Yes 1 4 2 5 3 3 2 1 4 5 Yes 1 2 3 4 5 5 3 1 4 2 Yes 1 2 3 4 5 3 1 5 4 2
result:
ok Correct!
Subtask #2:
score: 10
Accepted
Test #4:
score: 10
Accepted
time: 0ms
memory: 3472kb
input:
10 10 1 2 3 4 3 1 2 4 3 8 10 1 2 1 1 4 6 4 5 2 9 10 1 2 2 4 5 3 7 7 2 3 10 1 1 2 4 5 4 3 5 7 7 10 1 2 2 4 4 1 6 6 6 10 10 1 2 2 4 1 3 7 7 1 10 10 1 2 3 4 2 1 3 3 1 7 10 1 1 1 4 5 1 3 5 4 7 10 1 2 2 1 1 2 6 5 8 5 10 1 2 2 2 5 3 6 2 4 5
output:
Yes 1 2 3 4 5 6 7 10 8 9 6 1 7 2 9 5 3 8 4 10 Yes 1 2 3 7 5 4 6 8 10 9 4 3 1 9 2 8 5 6 7 10 Yes 1 2 10 6 3 4 5 7 8 9 1 9 3 2 4 5 6 8 7 10 Yes 1 3 2 4 5 6 10 9 7 8 2 1 7 3 6 4 8 5 9 10 Yes 1 2 3 4 5 9 8 7 6 10 6 1 3 2 5 4 7 8 9 10 Yes 1 2 6 3 4 5 7 8 9 10 9 5 1 3 2 4 6 8 7 10 Yes 1 2 3 4 5 6 10...
result:
ok Correct!
Test #5:
score: 10
Accepted
time: 0ms
memory: 3584kb
input:
10 10 1 1 3 1 1 1 2 3 5 7 10 1 2 2 1 4 5 6 7 9 8 10 1 2 2 1 5 4 2 3 6 8 10 1 1 1 4 5 3 1 2 2 3 10 1 1 2 4 5 2 6 2 6 3 10 1 2 3 3 5 4 6 1 9 6 10 1 1 1 4 1 4 1 2 8 10 10 1 2 2 2 1 3 1 1 5 8 10 1 1 3 1 5 3 2 5 6 5 10 1 2 3 4 1 5 7 8 4 2
output:
Yes 1 7 2 3 4 9 5 6 8 10 6 5 4 2 1 8 3 10 7 9 Yes 1 2 3 5 4 7 6 10 8 9 4 1 3 2 6 5 8 7 9 10 Yes 1 2 8 3 6 4 5 7 9 10 4 1 7 3 2 5 9 6 10 8 Yes 1 9 8 2 10 6 3 4 5 7 7 3 2 1 4 5 6 8 9 10 Yes 1 8 6 3 2 4 5 7 9 10 2 1 10 3 4 5 9 7 6 8 Yes 1 2 3 6 4 5 7 8 9 10 8 1 2 4 3 5 10 7 6 9 Yes 1 8 2 3 4 5 6 ...
result:
ok Correct!
Test #6:
score: 10
Accepted
time: 0ms
memory: 3608kb
input:
10 10 1 1 1 3 5 4 1 2 8 9 10 1 2 2 1 2 2 5 4 5 1 10 1 1 1 1 1 2 5 2 1 10 10 1 2 2 3 2 1 3 4 7 4 9 1 1 4 3 3 5 5 4 5 9 1 1 2 2 5 4 6 3 3 9 1 2 1 4 3 5 2 5 3 10 1 2 2 4 2 5 5 3 1 9 9 1 2 3 2 4 5 6 8 9 10 1 1 1 1 4 6 4 5 7 10
output:
Yes 1 8 2 4 3 5 6 7 10 9 7 3 2 1 6 4 5 9 8 10 Yes 1 2 3 8 4 9 7 5 6 10 10 4 1 6 5 3 2 7 8 9 Yes 1 8 6 2 3 4 7 5 9 10 9 5 4 3 2 1 6 7 8 10 Yes 1 2 7 4 3 5 6 8 9 10 6 1 5 3 2 10 8 4 9 7 No Yes 1 4 3 2 5 7 6 8 9 2 1 9 8 3 6 4 5 7 Yes 1 2 9 5 3 4 6 7 8 3 1 7 2 4 8 6 5 9 Yes 1 2 8 3 4 7 6 5 10 9 9 ...
result:
ok Correct!
Subtask #3:
score: 15
Accepted
Test #7:
score: 15
Accepted
time: 66ms
memory: 19296kb
input:
10 177329 1 1 2 2 1 4 1 2 3 3 2 3 4 1 2 3 3 2 2 2 2 3 4 3 1 2 4 2 4 1 4 2 2 4 1 3 3 4 1 1 1 3 2 4 3 3 2 4 2 2 4 1 1 4 3 1 4 4 4 3 1 4 1 3 2 1 2 3 2 4 2 4 4 2 1 3 2 2 2 3 3 1 4 1 3 1 2 4 1 4 2 3 4 3 1 4 4 1 2 2 3 3 4 1 4 4 3 4 3 2 1 2 4 3 1 1 4 4 4 2 3 4 3 3 3 1 4 4 1 1 2 4 4 1 3 4 4 4 2 1 2 2 1 2 3 ...
output:
Yes 1 177328 177326 177324 177321 177317 177313 177312 177311 177308 177294 177292 177290 177278 177270 177265 177262 177253 177242 177237 177233 177232 177213 177212 177210 177206 177191 177189 177188 177187 177180 177179 177175 177172 177168 177165 177164 177162 177155 177151 177145 177143 177140 ...
result:
ok Correct!
Test #8:
score: 15
Accepted
time: 82ms
memory: 20252kb
input:
10 42861 1 2 1 2 3 1 2 2 1 1 3 4 3 1 2 3 2 2 3 2 3 4 2 2 2 4 2 3 1 2 1 4 4 2 4 3 1 1 4 3 1 1 4 1 1 4 3 3 1 3 3 3 2 4 4 1 3 2 1 1 1 1 1 1 4 3 1 1 2 4 1 1 2 4 2 3 4 4 4 2 4 3 3 3 2 1 3 4 4 3 1 3 4 4 4 1 4 4 1 3 2 4 4 3 3 4 3 3 4 3 1 4 2 1 2 3 2 4 3 4 1 2 3 4 2 4 1 3 4 1 1 1 4 3 4 2 1 4 3 1 3 3 2 1 1 4...
output:
Yes 1 2 42861 42858 42854 42853 42841 42839 42838 42835 42827 42820 42798 42797 42795 42791 42785 42782 42781 42777 42774 42770 42757 42756 42753 42751 42741 42739 42735 42733 42715 42710 42706 42700 42696 42678 42673 42670 42667 42662 42661 42657 42656 42653 42642 42638 42636 42634 42629 42626 4262...
result:
ok Correct!
Test #9:
score: 15
Accepted
time: 67ms
memory: 19964kb
input:
10 45364 1 1 1 1 1 1 1 2 2 2 2 1 2 4 3 3 1 4 1 3 2 2 3 1 2 2 3 2 3 3 3 2 3 3 2 3 2 1 1 3 4 2 2 4 4 3 1 2 4 1 3 4 4 1 3 4 1 4 3 2 1 2 3 3 4 4 1 3 3 3 2 3 4 4 2 1 2 1 2 1 1 2 2 2 3 1 3 3 1 4 1 3 1 2 3 4 2 2 3 3 1 3 3 4 4 4 4 1 1 4 4 1 4 2 2 1 1 4 3 3 4 3 4 4 4 4 4 1 4 4 1 4 3 1 3 1 3 3 4 1 1 2 1 2 1 3...
output:
Yes 1 45363 45360 45359 45344 45342 45340 45332 45330 45329 45321 45313 45306 45297 45294 45290 45289 45285 45270 45268 45263 45251 45249 45245 45241 45237 45233 45232 45230 45228 45227 45224 45222 45218 45216 45207 45203 45200 45196 45195 45190 45187 45186 45185 45182 45181 45180 45167 45166 45161 ...
result:
ok Correct!
Test #10:
score: 15
Accepted
time: 67ms
memory: 16528kb
input:
10 60502 1 1 3 2 4 3 2 4 4 1 2 2 3 3 4 3 3 4 3 1 3 4 1 2 1 1 2 1 4 2 2 2 4 4 4 3 3 1 4 1 3 4 4 4 4 2 1 3 1 2 4 4 2 1 4 4 1 2 3 3 1 2 2 4 1 3 3 1 4 1 2 2 4 1 1 4 2 1 3 3 4 4 4 4 2 2 2 2 4 4 4 3 4 3 2 4 4 4 1 4 2 3 2 3 2 3 2 1 3 2 4 2 1 1 1 3 2 3 2 2 1 2 1 4 2 2 4 4 2 3 2 4 2 1 4 2 3 2 1 1 1 1 3 2 2 3...
output:
Yes 1 60502 60495 60486 60483 60481 60479 60478 60472 60467 60462 60454 60450 60446 60442 60440 60436 60435 60432 60428 60426 60422 60418 60414 60412 60408 60401 60395 60390 60382 60380 60373 60371 60370 60369 60365 60361 60352 60348 60346 60344 60342 60340 60337 60335 60334 60330 60329 60323 60310 ...
result:
ok Correct!
Test #11:
score: 15
Accepted
time: 81ms
memory: 20140kb
input:
10 192651 1 2 4 1 3 2 3 1 1 4 2 2 2 2 1 3 2 3 1 1 1 1 2 4 3 4 2 2 1 2 3 4 4 3 1 3 1 4 1 3 4 1 4 2 4 1 2 1 2 2 4 2 4 4 1 4 3 2 2 1 1 3 1 3 2 2 3 1 4 3 4 4 3 1 3 2 2 2 3 3 3 1 1 2 3 3 2 3 2 3 3 4 2 4 1 1 2 1 4 4 1 1 1 1 1 2 2 2 2 4 3 3 4 4 2 3 2 1 2 3 2 2 1 4 3 4 1 4 2 4 4 4 2 1 1 3 2 1 2 1 3 1 2 3 1 ...
output:
No Yes 1 165219 165214 165213 165211 165209 165208 165205 165198 165193 165188 165187 165179 165177 165173 165172 165170 165163 165158 165155 165153 165135 165127 165125 165122 165120 165119 165117 165103 165098 165096 165093 165092 165091 165090 165087 165081 165080 165078 165077 165074 165062 1650...
result:
ok Correct!
Test #12:
score: 15
Accepted
time: 76ms
memory: 18672kb
input:
10 96064 1 1 1 1 4 4 1 4 1 1 2 1 3 4 3 2 2 2 1 1 1 2 1 1 3 4 1 2 2 3 2 2 3 4 4 3 3 3 4 3 2 3 3 4 3 4 3 4 2 3 2 2 3 4 1 1 1 2 3 2 3 3 4 1 4 4 3 1 2 3 3 3 3 2 4 4 2 2 3 4 4 1 4 1 1 2 1 4 2 3 3 2 4 2 1 4 3 4 1 4 4 2 1 3 1 2 4 2 2 4 3 3 4 4 4 3 3 4 1 3 2 1 2 1 2 1 2 1 2 4 3 4 1 4 4 4 2 1 2 1 4 3 3 4 2 1...
output:
Yes 1 96061 96059 96058 96057 96056 96055 96053 96050 96049 96044 96037 96034 96028 96027 96026 96016 96013 96011 96009 96007 96004 96001 96000 95995 95992 95989 95986 95985 95975 95972 95967 95962 95959 95953 95952 95943 95942 95940 95934 95927 95924 95921 95920 95917 95912 95910 95909 95905 95899 ...
result:
ok Correct!
Subtask #4:
score: 15
Accepted
Test #13:
score: 15
Accepted
time: 204ms
memory: 26728kb
input:
10 199850 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 10...
output:
Yes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...
result:
ok Correct!
Test #14:
score: 15
Accepted
time: 239ms
memory: 26588kb
input:
10 199997 1 1 1 4 4 6 4 8 4 10 11 10 6 14 15 16 17 15 19 15 14 4 15 10 25 26 27 1 29 30 31 26 33 15 30 36 37 38 39 38 33 4 10 44 25 33 33 11 49 50 31 1 53 54 55 14 50 58 8 49 36 6 63 39 65 6 33 10 69 29 19 72 29 74 1 76 63 49 4 80 50 82 83 15 4 86 87 50 89 36 27 89 93 11 95 63 1 37 99 100 101 102 10...
output:
Yes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...
result:
ok Correct!
Test #15:
score: 15
Accepted
time: 254ms
memory: 27292kb
input:
10 199730 1 2 2 2 1 2 2 1 2 10 2 12 13 10 15 16 17 13 19 20 1 13 16 24 19 2 27 28 29 17 28 12 1 16 28 1 17 13 24 17 41 42 24 17 41 28 47 2 2 2 51 52 51 15 42 56 57 42 59 20 51 62 47 64 47 66 42 12 69 70 69 15 51 74 10 47 77 78 13 69 81 82 83 84 64 2 87 28 10 90 91 10 13 74 70 96 97 12 99 17 15 17 87...
output:
Yes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...
result:
ok Correct!
Test #16:
score: 15
Accepted
time: 208ms
memory: 22248kb
input:
10 199782 1 2 2 2 1 1 1 1 1 2 2 2 2 2 2 2 1 1 1 1 2 2 1 2 1 1 2 1 1 2 2 1 33 33 33 33 1 2 1 1 2 2 1 2 2 33 2 1 1 1 33 33 2 33 2 1 2 2 1 1 2 1 1 33 2 2 1 33 2 1 33 1 1 2 2 33 2 33 2 1 33 33 33 2 2 1 1 1 1 1 33 2 2 2 2 33 1 1 2 33 1 33 1 1 1 2 2 2 33 33 33 2 2 1 33 2 33 2 2 2 33 33 1 1 33 1 33 2 1 2 3...
output:
Yes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...
result:
ok Correct!
Test #17:
score: 15
Accepted
time: 134ms
memory: 21824kb
input:
10 199768 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
Yes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...
result:
ok Correct!
Test #18:
score: 15
Accepted
time: 24ms
memory: 4328kb
input:
10 199897 1 133473 137888 154846 104937 137888 3569 104774 144338 186307 16043 175982 174471 97731 56127 91564 38890 40649 89585 22112 91564 169703 102594 111754 96581 132350 39595 142435 3652 102405 58841 71649 89585 104964 111754 27732 141427 45005 177850 292 102734 71015 113628 177036 16043 30227...
output:
No No No No No No No No No No
result:
ok Correct!
Subtask #5:
score: 50
Accepted
Test #19:
score: 50
Accepted
time: 383ms
memory: 21296kb
input:
10 199755 1 2 1 3 5 1 6 7 2 1 5 6 10 9 12 2 4 14 2 18 5 17 23 4 6 7 4 6 20 27 16 24 29 8 33 26 33 27 17 39 5 33 34 41 4 16 24 19 42 8 29 48 48 27 37 24 43 13 4 28 38 27 38 23 29 55 14 62 26 9 62 20 35 31 57 74 69 5 26 60 33 59 5 19 21 45 15 87 3 54 17 2 57 36 18 67 25 62 47 53 89 27 5 59 75 77 29 9 ...
output:
Yes 1 2 44148 18205 13736 552 89 4 3 5 158751 150925 56126 7551 720 28 25 12 7 6 147309 39952 18042 5623 3594 50 34 8 197288 22540 18908 260 108 70 14 9 15809 4960 3944 1532 784 746 681 13 10 45366 9787 7391 11 185481 158134 34754 3784 1489 1038 1012 318 218 203 194 185 152 87 15 112749 13641 11708 ...
result:
ok Correct!
Test #20:
score: 50
Accepted
time: 360ms
memory: 21068kb
input:
10 199738 1 1 2 1 5 4 6 6 2 8 7 1 5 13 11 9 7 13 3 8 7 14 8 24 17 12 1 11 20 28 4 20 17 12 6 15 32 36 19 11 25 37 26 43 4 37 22 5 18 10 46 51 41 20 23 52 7 28 49 49 27 62 25 7 17 55 59 27 19 1 32 51 9 54 4 24 13 26 7 78 11 40 30 63 31 8 71 61 24 26 57 35 36 76 49 4 89 51 48 100 72 100 58 3 59 66 36 ...
output:
Yes 1 23771 5415 1364 1294 699 520 296 9 3 2 185413 48028 30012 20860 3512 125 96 75 45 31 6 4 5 56069 43670 22840 5598 2341 768 137 79 64 57 21 17 11 7 104244 87633 62647 51389 42491 33410 23708 538 435 422 385 273 86 23 20 10 8 174436 134319 63040 44557 37673 5781 871 34 26 12 182981 19872 8302 34...
result:
ok Correct!
Test #21:
score: 50
Accepted
time: 368ms
memory: 20616kb
input:
10 199701 1 1 3 2 5 6 6 1 1 5 7 10 13 12 1 12 5 16 10 19 16 6 21 20 21 17 18 26 8 17 13 18 9 34 32 1 24 10 35 15 26 31 37 42 1 19 22 40 32 3 16 48 19 11 47 17 31 24 27 54 20 7 55 9 24 4 24 25 21 12 65 62 38 11 50 13 43 69 53 54 78 61 80 19 6 9 55 77 60 26 42 19 16 60 32 94 25 39 29 57 4 93 56 56 86 ...
output:
Yes 1 57892 39551 4 2 3 5 6 32964 26754 12723 2322 1912 990 500 62 11 7 194923 134685 84814 71880 47187 40550 8933 1153 570 29 8 179296 98854 29746 19263 9141 168 86 64 33 9 18379 8245 2309 574 38 19 12 10 13 54894 992 604 545 460 14 112450 72850 70412 31841 8149 4542 2655 1350 1270 941 786 40 15 11...
result:
ok Correct!
Test #22:
score: 50
Accepted
time: 189ms
memory: 26924kb
input:
10 199753 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 10...
output:
Yes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...
result:
ok Correct!
Test #23:
score: 50
Accepted
time: 194ms
memory: 20796kb
input:
10 199750 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...
output:
Yes 1 3 2 5 4 7 6 9 8 11 10 13 12 15 14 17 16 19 18 21 20 23 22 25 24 27 26 29 28 31 30 33 32 35 34 37 36 39 38 41 40 43 42 45 44 47 46 49 48 51 50 53 52 55 54 57 56 59 58 61 60 63 62 65 64 67 66 69 68 71 70 73 72 75 74 77 76 79 78 81 80 83 82 85 84 87 86 89 88 91 90 93 92 95 94 97 96 99 98 101 100 ...
result:
ok Correct!
Test #24:
score: 50
Accepted
time: 383ms
memory: 21072kb
input:
10 200000 1 2 2 2 5 3 6 2 9 1 9 5 6 1 15 12 9 15 9 19 7 14 16 23 7 16 6 14 17 20 24 8 32 6 14 11 15 30 4 38 17 37 24 11 27 2 27 17 19 32 36 25 31 26 35 1 10 31 46 17 4 39 28 3 49 22 24 47 33 4 28 26 20 74 67 73 57 33 23 62 73 14 16 67 37 83 8 4 51 2 2 81 88 27 28 11 49 45 25 31 37 77 83 99 8 44 63 3...
output:
Yes 1 2 143734 81115 31044 8177 4999 3487 396 64 6 3 120113 110967 32886 21112 9567 2172 839 159 88 70 61 39 4 5 129956 120837 101292 94450 59320 16541 8639 7883 5006 1607 502 455 128 25 21 7 36395 21718 15729 12812 5549 1933 1514 845 150 105 87 32 8 9 49069 38795 33779 12799 5943 2698 2025 410 376 ...
result:
ok Correct!
Test #25:
score: 50
Accepted
time: 364ms
memory: 21376kb
input:
10 199804 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 4 3 6 2 5 1 5 6 2 7 1 12 12 14 16 16 3 10 7 16 5 25 17 20 5 13 15 6 7 7 21 9 18 26 8 26 6 22 34 25 24 21 9 16 3 13 48 42 41 50 43 26 17 12 53 57 43 56 60 63 42 29 63 20 40 7 6 65 66 64 36 25 72 49 14 27 37 32 59 61 9 85 31 70 21 2 54 12 50 31 7...
output:
Yes 1 37408 32500 16840 15835 13794 4146 3241 2352 1928 548 403 109 32 27 23 22 2 167673 131508 48187 13796 6512 2421 1889 1120 848 622 228 68 40 25 3 170658 4692 3691 24 4 9920 1318 1071 485 368 341 196 48 44 30 28 5 149483 37485 32150 6315 507 90 60 51 31 26 6 82656 48593 36006 34392 10160 8790 53...
result:
ok Correct!
Test #26:
score: 50
Accepted
time: 372ms
memory: 21020kb
input:
10 199826 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 3 2 3 6 5 4 1 10 9 7 7 3 6 4 5 7 10 6 7 5 6 3 20 22 11 11 27 27 21 17 5 32 17 26 10 4 29 29 11 24 14 27 32 11 43 36 21 22 13 28 43 33 17 51 7 15 30 37 38 8 28 61 4 38 65 65 4 23 22 35 4 8 1 43 75 39 12 38 73 50 42 71 80 82 69 88 9 44 84 12 49 83 ...
output:
Yes 1 175827 163442 56304 4502 2130 946 409 312 246 142 131 24 22 2 172281 12729 10084 6701 3187 3181 1148 794 410 273 208 44 34 25 23 3 170423 160812 144016 103464 95927 6352 1165 322 227 93 89 85 58 36 28 4 16351 11003 3454 1652 375 53 42 37 27 5 56116 7798 6825 771 723 714 373 320 175 152 43 40 3...
result:
ok Correct!
Test #27:
score: 50
Accepted
time: 371ms
memory: 21296kb
input:
10 199955 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 4 1 6 7 1 8 8 1 7 12 10 8 9 13 5 3 19 18 8 15 24 5 5 14 23 13 14 6 29 28 12 13 3 7...
output:
Yes 1 169187 47823 11267 1641 851 726 396 178 2 81195 19184 11003 3091 712 638 273 229 210 139 137 120 104 3 77313 51220 45651 19565 16885 2870 2068 275 222 183 158 156 141 105 4 54797 45910 27441 19744 14207 12341 2326 798 684 443 143 127 126 119 5 130243 98502 42388 14229 13731 12108 9709 3354 159...
result:
ok Correct!
Test #28:
score: 50
Accepted
time: 329ms
memory: 20696kb
input:
10 199833 1 1 1 1 9 5 4 7 2 6 7 2 12 2 4 7 6 4 6 19 18 2 8 6 18 22 21 7 25 18 22 24 24 29 1 3 10 18 28 26 33 3 25 42 17 37 31 14 26 39 18 25 35 6 21 4 5 37 34 56 25 7 26 25 17 22 31 42 54 6 17 35 13 34 15 1 35 37 43 19 50 70 59 70 34 45 63 37 29 4 82 52 35 8 4 10 45 33 40 40 58 23 73 74 86 3 54 55 4...
output:
No Yes 1 2 79647 64000 62830 44074 40158 24434 18073 13082 3807 2404 1491 1382 38 23 11 9 3 151980 120602 37959 4642 937 517 143 15 6 5 4 133678 105388 54803 44839 40240 30228 11227 5808 1709 121 7 143955 135099 101136 11046 5774 2957 276 93 32 14 13 12 10 8 157095 82931 66435 9296 2903 2246 309 107...
result:
ok Correct!