QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#210420 | #5364. 面国漫步 | BqtMtszDnlpsT | 7 | 1ms | 5776kb | C++20 | 3.0kb | 2023-10-11 14:07:47 | 2023-10-11 14:07:47 |
answer
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fll
#define For(i_,l_,r_) for(int i_=(l_);i_<=(r_);i_++)
#define Rep(i_,l_,r_) for(int i_=(l_);i_>=(r_);i_--)
#define Go(u_,i_) for(int i_=hd[u_],v=e[i_].to;i_;i_=e[i_].nxt,v=e[i_].to)
using namespace std;
#define Ci const int
#define Cl const ll
#define Cil const ull
#define Cc const char
#define _c_ getchar()
#define getchar() (_u==_v&&(_v=(_u=_c)+fread(_c,1,inS,stdin),_u==_v)?EOF:*_u++)
Ci M=998244353;
inline int Add(Ci x){return x>=M?x-M:x;}
inline int Add(Ci x,Ci p){return x>=p?x-p:x;}
const int inS=1<<18,ouS=1<<18;int _p,_l=-1;
char _b[ouS],_d[55],_c[inS],*_u=_c,*_v=_c;
template<typename T=int>inline T read(){
char ch=_c_;T X=0;bool fl=0;while(ch<48||ch>57)fl|=(ch==45),ch=_c_;
while(ch>47&&ch<58)X=X*10+(ch^48),ch=_c_;if(fl)return-X;return X;
}
inline char Gec(){char ch=_c_;while(ch<33)ch=_c_;return ch;}
inline int Ges(char*K){
int L=0;char ch=_c_;while(ch<33)ch=_c_;
while(ch>32)*K++=ch,ch=_c_,++L;*K++=0;return L;
}
template<typename T>inline void read(T B,const T E){for(;B!=E;B++)*B=read();}
inline void flush(){fwrite(_b,1,_l+1,stdout);_l=-1;}
inline void _pc(Cc&C){if(C!=-1)_b[++_l]=C;}
inline void _chf(){if(_l>(ouS>>1))flush();}
inline void puc(Cc&C){_b[++_l]=C;}
inline void pus(Cc*K,Cc&C=10){while(*K)_b[++_l]=*K++;_pc(C);_chf();}
inline void write(Cc&C){_b[++_l]=C;}
inline void write(Cc*K){while(*K)_b[++_l]=*K++;_chf();}
template<typename T>inline void write(T X,Cc&C=-1){
if(X<0)_b[++_l]=45,X=-X;do{_d[++_p]=(X%10)|48;}while(X/=10);
do{_b[++_l]=_d[_p];}while(--_p);_pc(C);_chf();
}
template<typename T,typename...A>void write(const T&X,const A&...a){write(X);write(a...);}
template<typename T>inline void writel(T B,const T E,Cc&c=' ',Cc&e='\n'){
for(;B!=E;)write(*B),_pc(++B!=E?c:e);
}
#define Writel(x) template<typename T>inline void writel(const x<T>&g,Cc&c=' ',Cc&e='\n'){writel(g.begin(),g.end(),c,e);}
Writel(initializer_list);Writel(vector);Writel(set);Writel(multiset);
Ci N_=1e2+5,M_=1e5+5;
inline void init(){
// freopen("meow.in","r",stdin);
// freopen("meow.out","w",stdout);
atexit(flush);
}
int n,m,p[N_],a[N_],inq[N_],L,q[M_],ql;
bool vis[M_];
ll dis[N_],mn[N_];
struct G{ll x,y,w;}ans[M_];
inline void ypa(){
n=read(),m=read();read(p+1,p+1+m);
For(i,2,n)dis[i]=1ll<<60;
For(i,1,m)a[p[i]]=i;
For(i,1,n)vis[a[i]]=1;
For(i,1,m-1){
int r=i+1;
while(!vis[r])++r;
int l=i;i=r-1;
For(j,1,n)q[j]=0;
For(j,l+1,r){
if(q[p[j]]==1)return pus("YouAreFake!");
++q[p[j]];
}
For(j,l+1,r-1){
--dis[p[j]];
mn[p[j]]=(1ll<<60)-dis[p[j]];
ans[++ql]={p[l],p[j],dis[p[j]]-dis[p[l]]};
}
dis[p[r]]=dis[p[l]]+mn[p[l]];
ans[++ql]={p[l],p[r],mn[p[l]]};
}
pus("YouAreWrite!");write(ql,'\n');
For(i,1,ql)writel({ans[i].x,ans[i].y,ans[i].w});
}
signed main(){init();int T=1;For(i,1,T)ypa();return 0;}
详细
Subtask #1:
score: 7
Accepted
Test #1:
score: 7
Accepted
time: 0ms
memory: 5652kb
input:
3 1 1
output:
YouAreWrite! 0
result:
ok Accepted
Test #2:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
3 2 1 2
output:
YouAreWrite! 1 1 2 0
result:
ok Accepted
Test #3:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
3 2 1 3
output:
YouAreWrite! 1 1 3 0
result:
ok Accepted
Test #4:
score: 0
Accepted
time: 1ms
memory: 5656kb
input:
3 3 1 2 3
output:
YouAreWrite! 2 1 2 0 2 3 0
result:
ok Accepted
Test #5:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
3 3 1 2 2
output:
YouAreFake!
result:
ok Accepted
Test #6:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
3 3 1 3 2
output:
YouAreWrite! 2 1 3 0 3 2 0
result:
ok Accepted
Test #7:
score: 0
Accepted
time: 0ms
memory: 5712kb
input:
3 4 1 2 3 2
output:
YouAreWrite! 3 1 2 1152921504606846975 1 3 0 3 2 0
result:
ok Accepted
Test #8:
score: 0
Accepted
time: 1ms
memory: 5644kb
input:
3 5 1 2 3 2 3
output:
YouAreFake!
result:
ok Accepted
Test #9:
score: 0
Accepted
time: 1ms
memory: 5732kb
input:
3 3 1 3 3
output:
YouAreFake!
result:
ok Accepted
Test #10:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
3 5 1 2 3 2 2
output:
YouAreFake!
result:
ok Accepted
Test #11:
score: 0
Accepted
time: 1ms
memory: 5728kb
input:
3 5 1 2 3 3 2
output:
YouAreFake!
result:
ok Accepted
Test #12:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
3 4 1 3 3 2
output:
YouAreFake!
result:
ok Accepted
Test #13:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
3 4 1 3 3 3
output:
YouAreFake!
result:
ok Accepted
Test #14:
score: 0
Accepted
time: 1ms
memory: 5768kb
input:
3 4 1 2 2 2
output:
YouAreFake!
result:
ok Accepted
Test #15:
score: 0
Accepted
time: 1ms
memory: 5776kb
input:
3 5 1 3 2 3 3
output:
YouAreFake!
result:
ok Accepted
Subtask #2:
score: 0
Wrong Answer
Test #16:
score: 8
Accepted
time: 1ms
memory: 5708kb
input:
85 78 1 46 49 66 12 47 36 28 44 17 48 34 5 82 20 40 69 52 75 27 14 43 53 83 33 55 38 77 58 56 76 81 6 84 19 80 67 3 50 25 26 21 29 62 70 22 68 63 74 37 7 73 78 42 32 2 64 8 39 71 59 18 23 24 9 51 85 11 57 41 45 16 54 30 35 61 72 4
output:
YouAreWrite! 77 1 46 0 46 49 0 49 66 0 66 12 0 12 47 0 47 36 0 36 28 0 28 44 0 44 17 0 17 48 0 48 34 0 34 5 0 5 82 0 82 20 0 20 40 0 40 69 0 69 52 0 52 75 0 75 27 0 27 14 0 14 43 0 43 53 0 53 83 0 83 33 0 33 55 0 55 38 0 38 77 0 77 58 0 58 56 0 56 76 0 76 81 0 81 6 0 6 84 0 84 19 0 19 80 0 80 67 0 6...
result:
ok Accepted
Test #17:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
85 69 1 49 5 82 85 42 74 37 44 12 78 53 25 45 76 65 41 24 3 28 57 54 59 84 11 32 21 68 35 64 50 17 39 26 46 38 15 10 30 9 23 81 43 19 56 61 60 58 48 63 66 22 27 14 69 72 13 18 47 71 6 70 34 31 29 77 40 33 62
output:
YouAreWrite! 68 1 49 0 49 5 0 5 82 0 82 85 0 85 42 0 42 74 0 74 37 0 37 44 0 44 12 0 12 78 0 78 53 0 53 25 0 25 45 0 45 76 0 76 65 0 65 41 0 41 24 0 24 3 0 3 28 0 28 57 0 57 54 0 54 59 0 59 84 0 84 11 0 11 32 0 32 21 0 21 68 0 68 35 0 35 64 0 64 50 0 50 17 0 17 39 0 39 26 0 26 46 0 46 38 0 38 15 0 1...
result:
ok Accepted
Test #18:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
37 20 1 13 9 4 15 5 26 25 10 31 12 28 32 24 23 18 17 33 20 37
output:
YouAreWrite! 19 1 13 0 13 9 0 9 4 0 4 15 0 15 5 0 5 26 0 26 25 0 25 10 0 10 31 0 31 12 0 12 28 0 28 32 0 32 24 0 24 23 0 23 18 0 18 17 0 17 33 0 33 20 0 20 37 0
result:
ok Accepted
Test #19:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
80 69 1 3 26 13 22 60 70 64 37 35 43 20 49 32 68 6 40 4 44 29 10 47 66 52 34 31 36 73 19 45 69 71 75 77 55 67 78 2 38 15 59 54 63 8 41 24 21 42 25 16 61 7 51 14 23 50 48 33 27 46 17 56 5 80 9 74 28 53 76
output:
YouAreWrite! 68 1 3 0 3 26 0 26 13 0 13 22 0 22 60 0 60 70 0 70 64 0 64 37 0 37 35 0 35 43 0 43 20 0 20 49 0 49 32 0 32 68 0 68 6 0 6 40 0 40 4 0 4 44 0 44 29 0 29 10 0 10 47 0 47 66 0 66 52 0 52 34 0 34 31 0 31 36 0 36 73 0 73 19 0 19 45 0 45 69 0 69 71 0 71 75 0 75 77 0 77 55 0 55 67 0 67 78 0 78 ...
result:
ok Accepted
Test #20:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
77 28 1 8 74 32 68 50 29 63 12 10 36 42 38 26 58 21 13 24 64 53 28 45 66 22 20 60 61 75
output:
YouAreWrite! 27 1 8 0 8 74 0 74 32 0 32 68 0 68 50 0 50 29 0 29 63 0 63 12 0 12 10 0 10 36 0 36 42 0 42 38 0 38 26 0 26 58 0 58 21 0 21 13 0 13 24 0 24 64 0 64 53 0 53 28 0 28 45 0 45 66 0 66 22 0 22 20 0 20 60 0 60 61 0 61 75 0
result:
ok Accepted
Test #21:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
39 4 1 28 18 12
output:
YouAreWrite! 3 1 28 0 28 18 0 18 12 0
result:
ok Accepted
Test #22:
score: 0
Accepted
time: 1ms
memory: 5656kb
input:
76 28 1 40 67 5 44 73 31 32 11 38 56 66 24 7 29 6 26 22 23 12 4 33 21 36 65 34 43 47
output:
YouAreWrite! 27 1 40 0 40 67 0 67 5 0 5 44 0 44 73 0 73 31 0 31 32 0 32 11 0 11 38 0 38 56 0 56 66 0 66 24 0 24 7 0 7 29 0 29 6 0 6 26 0 26 22 0 22 23 0 23 12 0 12 4 0 4 33 0 33 21 0 21 36 0 36 65 0 65 34 0 34 43 0 43 47 0
result:
ok Accepted
Test #23:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
61 6 1 46 45 6 34 7
output:
YouAreWrite! 5 1 46 0 46 45 0 45 6 0 6 34 0 34 7 0
result:
ok Accepted
Test #24:
score: 0
Accepted
time: 1ms
memory: 5648kb
input:
70 57 1 60 56 34 51 40 55 53 28 42 29 8 10 39 26 4 41 31 62 57 2 11 3 46 66 37 33 61 47 24 32 69 30 70 43 49 17 68 59 67 18 44 15 45 19 7 22 25 52 20 38 58 14 23 48 54 6
output:
YouAreWrite! 56 1 60 0 60 56 0 56 34 0 34 51 0 51 40 0 40 55 0 55 53 0 53 28 0 28 42 0 42 29 0 29 8 0 8 10 0 10 39 0 39 26 0 26 4 0 4 41 0 41 31 0 31 62 0 62 57 0 57 2 0 2 11 0 11 3 0 3 46 0 46 66 0 66 37 0 37 33 0 33 61 0 61 47 0 47 24 0 24 32 0 32 69 0 69 30 0 30 70 0 70 43 0 43 49 0 49 17 0 17 68...
result:
ok Accepted
Test #25:
score: 0
Accepted
time: 1ms
memory: 5652kb
input:
62 28 1 30 14 31 37 21 61 23 9 42 11 27 10 49 17 60 15 46 22 57 62 6 48 32 44 25 41 54
output:
YouAreWrite! 27 1 30 0 30 14 0 14 31 0 31 37 0 37 21 0 21 61 0 61 23 0 23 9 0 9 42 0 42 11 0 11 27 0 27 10 0 10 49 0 49 17 0 17 60 0 60 15 0 15 46 0 46 22 0 22 57 0 57 62 0 62 6 0 6 48 0 48 32 0 32 44 0 44 25 0 25 41 0 41 54 0
result:
ok Accepted
Test #26:
score: 0
Accepted
time: 0ms
memory: 5720kb
input:
13 9 1 2 6 4 10 13 12 11 5
output:
YouAreWrite! 8 1 2 0 2 6 0 6 4 0 4 10 0 10 13 0 13 12 0 12 11 0 11 5 0
result:
ok Accepted
Test #27:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
95 52 1 83 55 65 6 4 33 44 95 84 58 93 25 73 76 47 74 24 78 2 82 10 28 87 14 64 12 11 94 42 71 79 43 77 50 61 29 60 54 9 15 40 92 56 37 48 27 70 34 63 51 16
output:
YouAreWrite! 51 1 83 0 83 55 0 55 65 0 65 6 0 6 4 0 4 33 0 33 44 0 44 95 0 95 84 0 84 58 0 58 93 0 93 25 0 25 73 0 73 76 0 76 47 0 47 74 0 74 24 0 24 78 0 78 2 0 2 82 0 82 10 0 10 28 0 28 87 0 87 14 0 14 64 0 64 12 0 12 11 0 11 94 0 94 42 0 42 71 0 71 79 0 79 43 0 43 77 0 77 50 0 50 61 0 61 29 0 29 ...
result:
ok Accepted
Test #28:
score: 0
Accepted
time: 1ms
memory: 5652kb
input:
48 16 1 26 20 32 44 48 25 46 13 34 38 9 23 18 35 47
output:
YouAreWrite! 15 1 26 0 26 20 0 20 32 0 32 44 0 44 48 0 48 25 0 25 46 0 46 13 0 13 34 0 34 38 0 38 9 0 9 23 0 23 18 0 18 35 0 35 47 0
result:
ok Accepted
Test #29:
score: 0
Accepted
time: 1ms
memory: 5724kb
input:
79 66 1 53 79 36 33 74 56 57 67 59 22 38 68 18 8 6 3 10 13 37 65 4 78 45 35 70 15 11 19 20 73 25 23 16 76 64 54 7 30 40 41 12 28 75 17 42 61 47 24 62 63 71 44 49 27 26 31 32 60 21 50 72 5 52 69 46
output:
YouAreWrite! 65 1 53 0 53 79 0 79 36 0 36 33 0 33 74 0 74 56 0 56 57 0 57 67 0 67 59 0 59 22 0 22 38 0 38 68 0 68 18 0 18 8 0 8 6 0 6 3 0 3 10 0 10 13 0 13 37 0 37 65 0 65 4 0 4 78 0 78 45 0 45 35 0 35 70 0 70 15 0 15 11 0 11 19 0 19 20 0 20 73 0 73 25 0 25 23 0 23 16 0 16 76 0 76 64 0 64 54 0 54 7 ...
result:
ok Accepted
Test #30:
score: -8
Wrong Answer
time: 1ms
memory: 5732kb
input:
30 16 3 10 7 15 8 5 9 29 13 25 21 11 1 22 16 12
output:
YouAreWrite! 15 3 10 0 10 7 0 7 15 0 15 8 0 8 5 0 5 9 0 9 29 0 29 13 0 13 25 0 25 21 0 21 11 0 11 1 0 1 22 0 22 16 0 16 12 0
result:
wrong answer Wrong Answer on the First line of output
Subtask #3:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%
Subtask #4:
score: 0
Skipped
Dependency #2:
0%
Subtask #5:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%