QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#210418#5364. 面国漫步BqtMtszDnlpsT0 1ms3444kbC++203.1kb2023-10-11 14:04:332023-10-11 14:04:34

Judging History

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

  • [2023-10-11 14:04:34]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3444kb
  • [2023-10-11 14:04:33]
  • 提交

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;
    if(a[1]>1)return pus("YouAreFake!");
    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("YouAreFake!");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;}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3384kb

input:

3 1
1

output:

YouAreFake!
0

result:

wrong answer Wrong Answer on the First line of output

Subtask #2:

score: 0
Wrong Answer

Test #16:

score: 0
Wrong Answer
time: 0ms
memory: 3444kb

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:

YouAreFake!
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
67...

result:

wrong answer Wrong Answer on the First line of output

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #2:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

0%