Submission #1076572

#TimeUsernameProblemLanguageResultExecution timeMemory
1076572ArturgoPortal (BOI24_portal)C11
Compilation error
0 ms0 KiB
long long N, A, B, C, X, Y, OX, OY; int main() { scanf("%lld %lld %lld", &N, &OX, &OY); N--; while(N--) { cin >> X >> Y; X -= OX; Y -= OY; while(X != 0) { long long R = A / X; A -= R * X; B -= R * Y; swap(A, X); swap(B, Y); } while(Y != 0) { C %= Y; swap(C, Y); } if(C != 0) { B %= C; } } if(A == 0 || C == 0) printf("-1"); else printf("%lld",abs(A*C)); }

Compilation message (stderr)

Main.c: In function 'main':
Main.c:3:5: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    3 |     scanf("%lld %lld %lld", &N, &OX, &OY); N--;
      |     ^~~~~
Main.c:3:5: 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, X, Y, OX, OY;
Main.c:5:9: error: 'cin' undeclared (first use in this function)
    5 |         cin >> X >> Y;
      |         ^~~
Main.c:5:9: note: each undeclared identifier is reported only once for each function it appears in
Main.c:10:13: warning: implicit declaration of function 'swap' [-Wimplicit-function-declaration]
   10 |             swap(A, X); swap(B, Y);
      |             ^~~~
Main.c:18:26: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   18 |     if(A == 0 || C == 0) printf("-1");
      |                          ^~~~~~
Main.c:18:26: warning: incompatible implicit declaration of built-in function 'printf'
Main.c:18:26: note: include '<stdio.h>' or provide a declaration of 'printf'
Main.c:19:10: warning: incompatible implicit declaration of built-in function 'printf'
   19 |     else printf("%lld",abs(A*C));
      |          ^~~~~~
Main.c:19:10: note: include '<stdio.h>' or provide a declaration of 'printf'
Main.c:19:24: warning: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   19 |     else printf("%lld",abs(A*C));
      |                        ^~~
Main.c:19:29: warning: 'abs' argument 1 type is 'long long int' where 'int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
   19 |     else printf("%lld",abs(A*C));
      |                            ~^~
<built-in>: note: built-in 'abs' declared here
Main.c:19:21: warning: format '%lld' expects argument of type 'long long int', but argument 2 has type 'int' [-Wformat=]
   19 |     else printf("%lld",abs(A*C));
      |                  ~~~^  ~~~~~~~~
      |                     |  |
      |                     |  int
      |                     long long int
      |                  %d