fork download
  1. #include <fstream>
  2. #include <vector>
  3. #include <cmath>
  4. #include <cstring>
  5. #include <algorithm>
  6. #include <iomanip>
  7. using namespace std;
  8.  
  9. ifstream F("hallway.in");
  10. ofstream G("hallway.out");
  11.  
  12. const double eps = 1e-8;
  13.  
  14. typedef pair<int,int> pdd;
  15. #define x first
  16. #define y second
  17.  
  18. const int N = 1010;
  19.  
  20. vector<pdd> pt;
  21. int n,m,k;
  22. int ds[N][N];
  23. int d[N];
  24. int mk[N];
  25.  
  26. int dist(pdd a,pdd b)
  27. {
  28. return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
  29. }
  30.  
  31. int main()
  32. {
  33. F>>n>>m>>k;
  34. for (int i=1;i<=k;++i)
  35. {
  36. int x,y;
  37. F>>x>>y;
  38. pt.push_back( make_pair(x,y) );
  39. }
  40. for (int i=1;i<=k;++i)
  41. for (int j=1;j<=k;++j)
  42. ds[i][j] = dist(pt[i-1],pt[j-1]);
  43. ds[0][k+1] = ds[k+1][0] = 1<<30;
  44. for (int i=1;i<=k;++i)
  45. {
  46. ds[0][i] = ds[i][0] = pt[i-1].y*pt[i-1].y;
  47. ds[i][k+1] = ds[k+1][i] = (m-pt[i-1].y)*(m-pt[i-1].y);
  48. }
  49. for (int i=1;i<=k+1;++i)
  50. d[i] = 1<<30;
  51. int n = 0;
  52. for (int i=1;i<=k+1;++i)
  53. {
  54. mk[n] = 1;
  55. int ans = 1<<30;
  56. for (int j=1;j<=k+1;++j)
  57. if ( !mk[j] )
  58. {
  59. d[j] = min(d[j],max(d[n],ds[n][j]));
  60. ans = min(ans,d[j]);
  61. }
  62. for (int j=1;j<=k+1;++j)
  63. if ( !mk[j] && d[j] == ans )
  64. {
  65. n = j;
  66. break;
  67. }
  68. if ( n == k+1 )
  69. {
  70. G<<fixed<<setprecision(8)<<sqrt(ans)/2<<'\n';
  71. return 0;
  72. }
  73. }
  74. }
  75.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: illegal character: \35
#include <fstream>
^
Main.java:1: error: class, interface, or enum expected
#include <fstream>
         ^
Main.java:2: error: illegal character: \35
#include <vector>
^
Main.java:3: error: illegal character: \35
#include <cmath>
^
Main.java:4: error: illegal character: \35
#include <cstring>
^
Main.java:5: error: illegal character: \35
#include <algorithm>
^
Main.java:6: error: illegal character: \35
#include <iomanip>
^
Main.java:9: error: class, interface, or enum expected
ifstream F("hallway.in");
^
Main.java:10: error: class, interface, or enum expected
ofstream G("hallway.out");
^
Main.java:12: error: class, interface, or enum expected
const double eps = 1e-8;
^
Main.java:14: error: class, interface, or enum expected
typedef pair<int,int> pdd;
^
Main.java:15: error: illegal character: \35
#define x first
^
Main.java:15: error: class, interface, or enum expected
#define x first
        ^
Main.java:16: error: illegal character: \35
#define y second
^
Main.java:20: error: class, interface, or enum expected
vector<pdd> pt;
^
Main.java:21: error: class, interface, or enum expected
int n,m,k;
^
Main.java:22: error: class, interface, or enum expected
int ds[N][N];
^
Main.java:23: error: class, interface, or enum expected
int d[N];
^
Main.java:24: error: class, interface, or enum expected
int mk[N];
^
Main.java:26: error: class, interface, or enum expected
int dist(pdd a,pdd b)
^
Main.java:29: error: class, interface, or enum expected
}
^
Main.java:34: error: class, interface, or enum expected
    for (int i=1;i<=k;++i)
    ^
Main.java:34: error: class, interface, or enum expected
    for (int i=1;i<=k;++i)
                 ^
Main.java:34: error: class, interface, or enum expected
    for (int i=1;i<=k;++i)
                      ^
Main.java:37: error: class, interface, or enum expected
        F>>x>>y;
        ^
Main.java:38: error: class, interface, or enum expected
        pt.push_back( make_pair(x,y) );
        ^
Main.java:39: error: class, interface, or enum expected
    }
    ^
Main.java:40: error: class, interface, or enum expected
    for (int i=1;i<=k;++i)
                 ^
Main.java:40: error: class, interface, or enum expected
    for (int i=1;i<=k;++i)
                      ^
Main.java:41: error: class, interface, or enum expected
        for (int j=1;j<=k;++j)
                     ^
Main.java:41: error: class, interface, or enum expected
        for (int j=1;j<=k;++j)
                          ^
Main.java:43: error: class, interface, or enum expected
    ds[0][k+1] = ds[k+1][0] = 1<<30;
    ^
Main.java:44: error: class, interface, or enum expected
    for (int i=1;i<=k;++i)
    ^
Main.java:44: error: class, interface, or enum expected
    for (int i=1;i<=k;++i)
                 ^
Main.java:44: error: class, interface, or enum expected
    for (int i=1;i<=k;++i)
                      ^
Main.java:47: error: class, interface, or enum expected
        ds[i][k+1] = ds[k+1][i] = (m-pt[i-1].y)*(m-pt[i-1].y);
        ^
Main.java:48: error: class, interface, or enum expected
    }
    ^
Main.java:49: error: class, interface, or enum expected
    for (int i=1;i<=k+1;++i)
                 ^
Main.java:49: error: class, interface, or enum expected
    for (int i=1;i<=k+1;++i)
                        ^
Main.java:51: error: class, interface, or enum expected
    int n = 0;
    ^
Main.java:52: error: class, interface, or enum expected
    for (int i=1;i<=k+1;++i)
    ^
Main.java:52: error: class, interface, or enum expected
    for (int i=1;i<=k+1;++i)
                 ^
Main.java:52: error: class, interface, or enum expected
    for (int i=1;i<=k+1;++i)
                        ^
Main.java:55: error: class, interface, or enum expected
        int ans = 1<<30;
        ^
Main.java:56: error: class, interface, or enum expected
        for (int j=1;j<=k+1;++j)
        ^
Main.java:56: error: class, interface, or enum expected
        for (int j=1;j<=k+1;++j)
                     ^
Main.java:56: error: class, interface, or enum expected
        for (int j=1;j<=k+1;++j)
                            ^
Main.java:60: error: class, interface, or enum expected
                ans = min(ans,d[j]);
                ^
Main.java:61: error: class, interface, or enum expected
            }
            ^
Main.java:62: error: class, interface, or enum expected
        for (int j=1;j<=k+1;++j)
                     ^
Main.java:62: error: class, interface, or enum expected
        for (int j=1;j<=k+1;++j)
                            ^
Main.java:66: error: class, interface, or enum expected
                break;
                ^
Main.java:67: error: class, interface, or enum expected
            }
            ^
Main.java:71: error: class, interface, or enum expected
            return 0;
            ^
Main.java:72: error: class, interface, or enum expected
        }
        ^
55 errors
stdout
Standard output is empty