Submission #1076623

#TimeUsernameProblemLanguageResultExecution timeMemory
1076623ArturgoPortal (BOI24_portal)C11
1 / 100
20 ms408 KiB
long long N,A,B,C,R,T,X,Y;int main(){scanf("%lld%lld%lld",&N,&R,&T);N--;while(N--){scanf("%lld%lld",&X,&Y);X-=R;Y-=T;while(X){R=A/X;A-=R*X;B-=R*Y;T=A;A=X;X=T;T=B;B=Y;Y=T;}while(Y){C%=Y;T=Y;Y=C;C=T;}if(C)B%=C;}if(A*C<0)A=-A;if(!A||!C)printf("-1");else printf("%lld",A*C);}

Compilation message (stderr)

Main.c: In function 'main':
Main.c:1:38: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    1 | long long N,A,B,C,R,T,X,Y;int main(){scanf("%lld%lld%lld",&N,&R,&T);N--;while(N--){scanf("%lld%lld",&X,&Y);X-=R;Y-=T;while(X){R=A/X;A-=R*X;B-=R*Y;T=A;A=X;X=T;T=B;B=Y;Y=T;}while(Y){C%=Y;T=Y;Y=C;C=T;}if(C)B%=C;}if(A*C<0)A=-A;if(!A||!C)printf("-1");else printf("%lld",A*C);}
      |                                      ^~~~~
Main.c:1:38: warning: incompatible implicit declaration of built-in function 'scanf'
Main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | long long N,A,B,C,R,T,X,Y;int main(){scanf("%lld%lld%lld",&N,&R,&T);N--;while(N--){scanf("%lld%lld",&X,&Y);X-=R;Y-=T;while(X){R=A/X;A-=R*X;B-=R*Y;T=A;A=X;X=T;T=B;B=Y;Y=T;}while(Y){C%=Y;T=Y;Y=C;C=T;}if(C)B%=C;}if(A*C<0)A=-A;if(!A||!C)printf("-1");else printf("%lld",A*C);}
Main.c:1:234: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    1 | long long N,A,B,C,R,T,X,Y;int main(){scanf("%lld%lld%lld",&N,&R,&T);N--;while(N--){scanf("%lld%lld",&X,&Y);X-=R;Y-=T;while(X){R=A/X;A-=R*X;B-=R*Y;T=A;A=X;X=T;T=B;B=Y;Y=T;}while(Y){C%=Y;T=Y;Y=C;C=T;}if(C)B%=C;}if(A*C<0)A=-A;if(!A||!C)printf("-1");else printf("%lld",A*C);}
      |                                                                                                                                                                                                                                          ^~~~~~
Main.c:1:234: warning: incompatible implicit declaration of built-in function 'printf'
Main.c:1:234: note: include '<stdio.h>' or provide a declaration of 'printf'
Main.c:1:252: warning: incompatible implicit declaration of built-in function 'printf'
    1 | long long N,A,B,C,R,T,X,Y;int main(){scanf("%lld%lld%lld",&N,&R,&T);N--;while(N--){scanf("%lld%lld",&X,&Y);X-=R;Y-=T;while(X){R=A/X;A-=R*X;B-=R*Y;T=A;A=X;X=T;T=B;B=Y;Y=T;}while(Y){C%=Y;T=Y;Y=C;C=T;}if(C)B%=C;}if(A*C<0)A=-A;if(!A||!C)printf("-1");else printf("%lld",A*C);}
      |                                                                                                                                                                                                                                                            ^~~~~~
Main.c:1:252: note: include '<stdio.h>' or provide a declaration of 'printf'
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...