fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <math.h>
  5. #include <limits.h>
  6. #include <stack>
  7. #include <queue>
  8. #include <map>
  9. #include <set>
  10. #include <algorithm>
  11. #include <string>
  12. #include <functional>
  13. #include <vector>
  14. #include <numeric>
  15. #include <deque>
  16. #include <utility>
  17. #include <bitset>
  18. #include <iostream>
  19. using namespace std;
  20. typedef long long lint;
  21. typedef long double llf;
  22. typedef pair<double, double> pi;
  23.  
  24. struct line{
  25. double a, b, c;
  26. };
  27.  
  28. pi cross(line p, line q){
  29. double base = p.a * q.b - p.b * q.a;
  30. if(fabs(base) < 1e-5) return pi(1e9, 1e9);
  31. return pi((p.b * q.c - q.b * p.c) / base, (p.c * q.a - q.c * p.a) / base);
  32. }
  33.  
  34. double func(line a, pi b){
  35. return a.a * b.first + a.b * b.second + a.c;
  36. }
  37.  
  38. void half_plane_intersect(vector<line> &v, vector<pi> &ret){
  39. int n = v.size();
  40. for(int i=0; i<n; i++){
  41. for(int j=i+1; j<n; j++){
  42. pi crs = cross(v[i], v[j]);
  43. if(fabs(crs.first - 1e9) < 1e-4) continue;
  44. bool bad = 0;
  45. for(int k=0; k<n; k++){
  46. if(func(v[k], crs) < -1e-4){
  47. bad = 1;
  48. break;
  49. }
  50. }
  51. if(!bad) ret.push_back(crs);
  52. }
  53. }
  54.  
  55. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/usr/lib/gcc/i586-linux-gnu/5/../../../i386-linux-gnu/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty