# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
310406 |
2020-10-06T21:17:16 Z |
aZvezda |
Towns (IOI15_towns) |
C++14 |
|
23 ms |
1024 KB |
#include "towns.h"
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
#define endl "\n"
typedef long long ll;
template<class T, class T2> inline ostream &operator <<(ostream &out, const pair<T, T2> &x) { out << x.first << " " << x.second; return out;}
template<class T, class T2> inline istream &operator >>(istream &in, pair<T, T2> &x) { in >> x.first >> x.second; return in;}
template<class T, class T2> inline bool chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline bool chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }
const ll mod = 1e9 + 7;
#define out(x) "{" << (#x) << ": " << x << "} "
const int MAX_N = 115;
int dist0[MAX_N], dist1[MAX_N];
pair<vector<int>, int> comp[MAX_N];
int hubDistance(int N, int sub) {
int first = 0;
for(int i = 1; i < N; i ++) {
dist0[i] = getDistance(0, i);
if(dist0[i] > dist0[first]) {
first = i;
}
}
int R = mod;
int second = 0;
for(int i = 0; i < N; i ++) {
dist1[i] = getDistance(first, i);
if(dist1[i] > dist1[second]) {
second = i;
}
}
for(int i = 0; i < N; i ++) {
int now = dist0[i] + dist1[i] - dist1[0]; now /= 2; now = dist1[i] - now;
chkmin(R, max({now, dist1[second] - now}));
}
return R;
}
Compilation message
towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:20:28: warning: unused parameter 'sub' [-Wunused-parameter]
20 | int hubDistance(int N, int sub) {
| ~~~~^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
504 KB |
Output is correct |
2 |
Correct |
16 ms |
896 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
23 ms |
1016 KB |
Output is correct |
5 |
Correct |
23 ms |
1024 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
384 KB |
Output is correct |
2 |
Correct |
16 ms |
768 KB |
Output is correct |
3 |
Correct |
22 ms |
896 KB |
Output is correct |
4 |
Correct |
22 ms |
896 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
17 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
384 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
16 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
18 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |