結果
問題 | No.94 圏外です。(EASY) |
ユーザー |
![]() |
提出日時 | 2016-06-09 01:01:27 |
言語 | C++11 (gcc 13.3.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,393 bytes |
コンパイル時間 | 494 ms |
コンパイル使用メモリ | 70,900 KB |
最終ジャッジ日時 | 2024-11-14 19:45:11 |
合計ジャッジ時間 | 1,059 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘double dist(std::pair<int, int>, std::pair<int, int>)’: main.cpp:40:12: error: ‘sqrt’ was not declared in this scope 40 | return sqrt(dist2(p.first,p.second,q.first,q.second)); | ^~~~
ソースコード
#include <iostream>#include <vector>#include <map>#include <algorithm>#include <iomanip>using namespace std;#define REP(i,s,e) for (i = s; i <= e; i++)#define rep(i,n) REP (i,0,(int)(n)-1)#define RREP(i,s,e) for (i = s; i >= e; i--)#define rrep(i,n) RREP (i,(int)(n)-1,0)#define INF (int)1e8#define MOD (int)(1e9+7)typedef long long ll;int n;int par[1000];void init() {int i;rep (i,n) par[i] = i;}int find(int x) {if (par[x] == x)return x;return par[x] = find(par[x]);}void unite(int x, int y) {par[find(x)] = find(y);}int dist2(int x1, int y1, int x2, int y2) {return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);}double dist(pair<int,int> p, pair<int,int> q) {return sqrt(dist2(p.first,p.second,q.first,q.second));}int main(void) {int i, j;pair<int,int> coo[1000];cin >> n;rep (i,n) cin >> coo[i].first >> coo[i].second;init();rep (i,n) REP (j,i+1,n-1) {if (dist2(coo[i].first,coo[i].second,coo[j].first,coo[j].second) <= 100)unite(i,j);}map<int,vector<int>> mp;rep (i,n) mp[find(i)].push_back(i);double ans = 1;for (auto& p : mp) {auto& v = p.second;rep (i,v.size()) rep (j,v.size())ans = max(ans,dist(coo[v[i]],coo[v[j]])+2);}cout << fixed << setprecision(7) << ans << endl;return 0;}