Submission #1076618

#TimeUsernameProblemLanguageResultExecution timeMemory
1076618ArturgoPortal (BOI24_portal)C11
100 / 100
25 ms600 KiB
long long N,A,B,C,R,T,X,Y,OX,OY;int main(){scanf("%lld%lld%lld",&N,&OX,&OY);N--;while(N--){scanf("%lld%lld",&X,&Y);X-=OX;Y-=OY;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==0||C==0)printf("-1");else printf("%lld",A*C);}

Compilation message (stderr)

Main.c: In function 'main':
Main.c:1:44: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    1 | long long N,A,B,C,R,T,X,Y,OX,OY;int main(){scanf("%lld%lld%lld",&N,&OX,&OY);N--;while(N--){scanf("%lld%lld",&X,&Y);X-=OX;Y-=OY;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==0||C==0)printf("-1");else printf("%lld",A*C);}
      |                                            ^~~~~
Main.c:1:44: 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,OX,OY;int main(){scanf("%lld%lld%lld",&N,&OX,&OY);N--;while(N--){scanf("%lld%lld",&X,&Y);X-=OX;Y-=OY;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==0||C==0)printf("-1");else printf("%lld",A*C);}
Main.c:1:248: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    1 | long long N,A,B,C,R,T,X,Y,OX,OY;int main(){scanf("%lld%lld%lld",&N,&OX,&OY);N--;while(N--){scanf("%lld%lld",&X,&Y);X-=OX;Y-=OY;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==0||C==0)printf("-1");else printf("%lld",A*C);}
      |                                                                                                                                                                                                                                                        ^~~~~~
Main.c:1:248: warning: incompatible implicit declaration of built-in function 'printf'
Main.c:1:248: note: include '<stdio.h>' or provide a declaration of 'printf'
Main.c:1:266: warning: incompatible implicit declaration of built-in function 'printf'
    1 | long long N,A,B,C,R,T,X,Y,OX,OY;int main(){scanf("%lld%lld%lld",&N,&OX,&OY);N--;while(N--){scanf("%lld%lld",&X,&Y);X-=OX;Y-=OY;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==0||C==0)printf("-1");else printf("%lld",A*C);}
      |                                                                                                                                                                                                                                                                          ^~~~~~
Main.c:1:266: 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...