# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
302403 | 2020-09-18T16:22:41 Z | square1001 | Towns (IOI15_towns) | C++14 | 38 ms | 928 KB |
#include "towns.h" #include <cmath> #include <vector> #include <iostream> #include <algorithm> using namespace std; int hubDistance(int N, int sub) { if(sub <= 2) { vector<int> da(N); for(int i = 1; i < N; ++i) { da[i] = getDistance(0, i); } int ma = max_element(da.begin(), da.end()) - da.begin(); vector<int> db(N); for(int i = 0; i < N; ++i) { if(i != ma) { db[i] = getDistance(ma, i); } } int mb = max_element(db.begin(), db.end()) - db.begin(); int mindiff = (1 << 30); for(int i = 0; i < N; ++i) { if(i != ma && i != mb) { int dy = getDistance(mb, i); mindiff = min(mindiff, abs(db[i] - dy)); } } return (db[mb] + mindiff) / 2; } else { // write code here } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 384 KB | Output is correct |
2 | Correct | 16 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
4 | Correct | 21 ms | 384 KB | Output is correct |
5 | Correct | 38 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 18 ms | 384 KB | Output is correct |
2 | Correct | 17 ms | 928 KB | Output is correct |
3 | Correct | 21 ms | 928 KB | Output is correct |
4 | Correct | 21 ms | 896 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 15 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 21 ms | 384 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 22 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 15 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |