fork(1) download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. typedef long long ll;
  6. typedef int64_t ll;
  7. typedef pair<int,int> ii;
  8. typedef pair<ll, ll> ill;
  9.  
  10. #define EL printf("\n")
  11. #define OK printf("OK")
  12. #define pb push_back
  13. #define mp make_pair
  14. #define X first
  15. #define Y second
  16. #define fillchar(a,x) memset(a, x, sizeof(a))
  17. #define FOR(i,l,r) for (int i=l;i<=r;i++)
  18. #define FORD(i,r,l) for (int i=r;i>=l;i--)
  19.  
  20. typedef pair<ii,int> dat;
  21. const int N = 1010;
  22. dat an[N];
  23. int n,x0,y0,xi,yi;
  24.  
  25. bool cmp(dat u, dat v) {
  26. return (u.X.X < v.X.X or (u.X.X == v.X.X and u.X.Y < v.X.Y)
  27. or (u.X == v.X and u.Y < v.Y));
  28. }
  29.  
  30. int main()
  31. {
  32. //freopen("INP.INP","r",stdin);
  33. //freopen("OUT.OUT","w",stdout);
  34.  
  35. scanf("%d%d%d\n", &n,&x0,&y0);
  36. FOR(i,1,n) {
  37. scanf("%d%d", &xi,&yi);
  38. int a = y0-yi;
  39. int b = xi-x0;
  40. int c = -y0*(x0-xi) + x0*(y0-yi);
  41. int g = __gcd(__gcd(a,b),c);
  42. a /= g;
  43. b /= g;
  44. c /= g;
  45. if (a < 0) {
  46. a = -a;
  47. b = -b;
  48. c = -c;
  49. }
  50. an[i] = mp(mp(a,b),c);
  51. }
  52. sort(an+1,an+n+1,cmp);
  53. int res = unique(an+1,an+n+1)-an-1;
  54. printf("%d\n", res);
  55.  
  56. return 0;
  57. }
  58.  
Compilation error #stdin compilation error #stdout 0s 4168KB
stdin
4 0 0
0 1
0 -1
1 0
-1 0
compilation info
prog.cpp:23:10: error: 'int y0' redeclared as different kind of symbol
 int n,x0,y0,xi,yi;
          ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/assert.h:35,
                 from /usr/include/c++/4.9/cassert:43,
                 from /usr/include/i386-linux-gnu/c++/4.9/bits/stdc++.h:33,
                 from prog.cpp:1:
/usr/include/i386-linux-gnu/bits/mathcalls.h:240:1: note: previous declaration 'double y0(double)'
 __MATHCALL (y0,, (_Mdouble_));
 ^
prog.cpp: In function 'int main()':
prog.cpp:38:20: warning: pointer to a function used in arithmetic [-Wpointer-arith]
         int a = y0-yi;
                    ^
prog.cpp:38:19: error: invalid conversion from 'double (*)(double) throw ()' to 'int' [-fpermissive]
         int a = y0-yi;
                   ^
prog.cpp:40:18: error: wrong type argument to unary minus
         int c = -y0*(x0-xi) + x0*(y0-yi);
                  ^
prog.cpp:40:38: warning: pointer to a function used in arithmetic [-Wpointer-arith]
         int c = -y0*(x0-xi) + x0*(y0-yi);
                                      ^
prog.cpp:40:40: error: invalid operands of types 'int' and 'double (*)(double) throw ()' to binary 'operator*'
         int c = -y0*(x0-xi) + x0*(y0-yi);
                                        ^
stdout
Standard output is empty