Submission #28382936
Source Code Expand
#ifndef LOCAL
#include <bits/stdc++.h>
using namespace std;
#define debug(...) 42
#else
#include "Debug.hpp"
#endif
class Task {
public:
void Perform() {
Read();
Solve();
}
private:
int n;
vector<int> x, y;
void Read() {
cin >> n;
x.resize(n);
y.resize(n);
for (int i = 0; i < n; ++i) {
cin >> x[i] >> y[i];
}
}
void Solve() {
double mx_dist = 0;
for (int i = 0; i < n; ++i) {
for (int j = i + 1; j < n; ++j) {
mx_dist = max(mx_dist, Dist(i, j));
}
}
cout << fixed << setprecision(10) << mx_dist << '\n';
}
double Dist(int i, int j) {
int dx = x[i] - x[j];
int dy = y[i] - y[j];
return sqrt(dx * dx + dy * dy);
}
};
int main() {
ios_base::sync_with_stdio(false), cin.tie(nullptr);
Task t;
t.Perform();
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Longest Segment |
| User | tauhrick |
| Language | C++ (GCC 9.2.1) |
| Score | 200 |
| Code Size | 884 Byte |
| Status | AC |
| Exec Time | 7 ms |
| Memory | 3792 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example0.txt, example1.txt |
| All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, example0.txt, example1.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 000.txt | AC | 7 ms | 3620 KiB |
| 001.txt | AC | 2 ms | 3688 KiB |
| 002.txt | AC | 2 ms | 3680 KiB |
| 003.txt | AC | 2 ms | 3680 KiB |
| 004.txt | AC | 2 ms | 3768 KiB |
| 005.txt | AC | 2 ms | 3628 KiB |
| 006.txt | AC | 2 ms | 3692 KiB |
| 007.txt | AC | 3 ms | 3692 KiB |
| 008.txt | AC | 3 ms | 3748 KiB |
| 009.txt | AC | 2 ms | 3632 KiB |
| 010.txt | AC | 3 ms | 3680 KiB |
| example0.txt | AC | 2 ms | 3792 KiB |
| example1.txt | AC | 2 ms | 3764 KiB |