# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
492563 | vulpes | Countries (BOI06_countries) | C++17 | Compilation error | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int N = 1007;
struct country {
int x, y, s, ind;
} a[N];
bool operator <(country a, country b) {
return (a.s != b.s ? a.s > b.s : a.ind < b.ind);
}
int dist(country x, country y) {
return (x.x - y.x) * (x.x - y.x) + (x.y - y.y) * (x.y - y.y);
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int n; cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i].x >> a[i].y >> a[i].s;
a[i].ind = i;
}
sort(a, a + n);
vector<string> ans(n);
for (int i = 0; i < n; i++) {
vector<country> v;
for (int j = 0; j < i; j++) {
if (a[j].s > dist(a[i], a[j]) * a[i].s) {
v.push_back(a[j]);
}
}
if (!v.size()) {
ans[a[i].ind] = "K"; continue;
}
int i1 = 0, i2 = -1, d1, d2;
for (int j = 0; j < v.size(); j++) {
d1 = a[v[i1].ind].s * dist(a[i], v[j]);
d2 = a[v[j].ind].s * dist(a[i], v[i1]);
if (d1 > d2) {
i1 = j; i2 = -1;
}
if (d1 == d2) {
i2 = j; continue;
}
}
if (~i2) {
ans[a[i].ind] = "D"; continue;
}
if (ans[v[i1].ind] != "K") {
ans[a[i].ind] = ans[v[i1].ind]; continue;
}
ans[a[i].ind] = to_string(v[i1].ind + 1);
}
for (string i : ans) {
cout << i << endl;
}
}
Compilation message (stderr)
countries.cpp:2:21: error: extended character is not valid in an identifier 2 | using namespace std; | ^ countries.cpp:4:20: error: extended character is not valid in an identifier 4 | const int N = 1007; | ^ countries.cpp:6:2: error: extended character is not valid in an identifier 6 | int x, y, s, ind; | ^ countries.cpp:9:2: error: extended character is not valid in an identifier 9 | return (a.s != b.s ? a.s > b.s : a.ind < b.ind); | ^ countries.cpp:12:2: error: extended character is not valid in an identifier 12 | return (x.x - y.x) * (x.x - y.x) + (x.y - y.y) * (x.y - y.y); | ^ countries.cpp:13:2: error: extended character is not valid in an identifier 13 | } | ^ countries.cpp:16:2: error: extended character is not valid in an identifier 16 | ios_base::sync_with_stdio(false); | ^ countries.cpp:17:2: error: extended character is not valid in an identifier 17 | cin.tie(0); cout.tie(0); | ^ countries.cpp:18:2: error: extended character is not valid in an identifier 18 | int n; cin >> n; | ^ countries.cpp:19:2: error: extended character is not valid in an identifier 19 | for (int i = 0; i < n; i++) { | ^ countries.cpp:20:2: error: extended character is not valid in an identifier 20 | cin >> a[i].x >> a[i].y >> a[i].s; | ^ countries.cpp:20:5: error: extended character is not valid in an identifier 20 | cin >> a[i].x >> a[i].y >> a[i].s; | ^ countries.cpp:20:8: error: extended character is not valid in an identifier 20 | cin >> a[i].x >> a[i].y >> a[i].s; | ^ countries.cpp:21:2: error: extended character is not valid in an identifier 21 | a[i].ind = i; | ^ countries.cpp:21:5: error: extended character is not valid in an identifier 21 | a[i].ind = i; | ^ countries.cpp:21:8: error: extended character is not valid in an identifier 21 | a[i].ind = i; | ^ countries.cpp:22:2: error: extended character is not valid in an identifier 22 | } | ^ countries.cpp:22:5: error: extended character is not valid in an identifier 22 | } | ^ countries.cpp:23:2: error: extended character is not valid in an identifier 23 | sort(a, a + n); | ^ countries.cpp:24:2: error: extended character is not valid in an identifier 24 | vector<string> ans(n); | ^ countries.cpp:25:2: error: extended character is not valid in an identifier 25 | for (int i = 0; i < n; i++) { | ^ countries.cpp:26:2: error: extended character is not valid in an identifier 26 | vector<country> v; | ^ countries.cpp:26:5: error: extended character is not valid in an identifier 26 | vector<country> v; | ^ countries.cpp:26:8: error: extended character is not valid in an identifier 26 | vector<country> v; | ^ countries.cpp:27:2: error: extended character is not valid in an identifier 27 | for (int j = 0; j < i; j++) { | ^ countries.cpp:27:5: error: extended character is not valid in an identifier 27 | for (int j = 0; j < i; j++) { | ^ countries.cpp:27:8: error: extended character is not valid in an identifier 27 | for (int j = 0; j < i; j++) { | ^ countries.cpp:28:2: error: extended character is not valid in an identifier 28 | if (a[j].s > dist(a[i], a[j]) * a[i].s) { | ^ countries.cpp:28:5: error: extended character is not valid in an identifier 28 | if (a[j].s > dist(a[i], a[j]) * a[i].s) { | ^ countries.cpp:28:8: error: extended character is not valid in an identifier 28 | if (a[j].s > dist(a[i], a[j]) * a[i].s) { | ^ countries.cpp:28:11: error: extended character is not valid in an identifier 28 | if (a[j].s > dist(a[i], a[j]) * a[i].s) { | ^ countries.cpp:28:14: error: extended character is not valid in an identifier 28 | if (a[j].s > dist(a[i], a[j]) * a[i].s) { | ^ countries.cpp:29:2: error: extended character is not valid in an identifier 29 | v.push_back(a[j]); | ^ countries.cpp:29:5: error: extended character is not valid in an identifier 29 | v.push_back(a[j]); | ^ countries.cpp:29:8: error: extended character is not valid in an identifier 29 | v.push_back(a[j]); | ^ countries.cpp:29:11: error: extended character is not valid in an identifier 29 | v.push_back(a[j]); | ^ countries.cpp:29:14: error: extended character is not valid in an identifier 29 | v.push_back(a[j]); | ^ countries.cpp:29:17: error: extended character is not valid in an identifier 29 | v.push_back(a[j]); | ^ countries.cpp:29:20: error: extended character is not valid in an identifier 29 | v.push_back(a[j]); | ^ countries.cpp:32:2: error: extended character is not valid in an identifier 32 | if (!v.size()) { | ^ countries.cpp:32:5: error: extended character is not valid in an identifier 32 | if (!v.size()) { | ^ countries.cpp:32:8: error: extended character is not valid in an identifier 32 | if (!v.size()) { | ^ countries.cpp:33:2: error: extended character is not valid in an identifier 33 | ans[a[i].ind] = "K"; continue; | ^ countries.cpp:33:5: error: extended character is not valid in an identifier 33 | ans[a[i].ind] = "K"; continue; | ^ countries.cpp:33:8: error: extended character is not valid in an identifier 33 | ans[a[i].ind] = "K"; continue; | ^ countries.cpp:33:11: error: extended character is not valid in an identifier 33 | ans[a[i].ind] = "K"; continue; | ^ countries.cpp:33:14: error: extended character is not valid in an identifier 33 | ans[a[i].ind] = "K"; continue; | ^ countries.cpp:35:2: error: extended character is not valid in an identifier 35 | int i1 = 0, i2 = -1, d1, d2; | ^ countries.cpp:35:5: error: extended character is not valid in an identifier 35 | int i1 = 0, i2 = -1, d1, d2; | ^ countries.cpp:35:8: error: extended character is not valid in an identifier 35 | int i1 = 0, i2 = -1, d1, d2; | ^ countries.cpp:35:11: error: extended character is not valid in an identifier 35 | int i1 = 0, i2 = -1, d1, d2; | ^ countries.cpp:36:2: error: extended character is not valid in an identifier 36 | for (int j = 0; j < v.size(); j++) { | ^ countries.cpp:36:5: error: extended character is not valid in an identifier 36 | for (int j = 0; j < v.size(); j++) { | ^ countries.cpp:36:8: error: extended character is not valid in an identifier 36 | for (int j = 0; j < v.size(); j++) { | ^ countries.cpp:36:11: error: extended character is not valid in an identifier 36 | for (int j = 0; j < v.size(); j++) { | ^ countries.cpp:37:2: error: extended character is not valid in an identifier 37 | d1 = a[v[i1].ind].s * dist(a[i], v[j]); | ^ countries.cpp:37:5: error: extended character is not valid in an identifier 37 | d1 = a[v[i1].ind].s * dist(a[i], v[j]); | ^ countries.cpp:37:8: error: extended character is not valid in an identifier 37 | d1 = a[v[i1].ind].s * dist(a[i], v[j]); | ^ countries.cpp:37:11: error: extended character is not valid in an identifier 37 | d1 = a[v[i1].ind].s * dist(a[i], v[j]); | ^ countries.cpp:37:14: error: extended character is not valid in an identifier 37 | d1 = a[v[i1].ind].s * dist(a[i], v[j]); | ^ countries.cpp:38:2: error: extended character is not valid in an identifier 38 | d2 = a[v[j].ind].s * dist(a[i], v[i1]); | ^ countries.cpp:38:5: error: extended character is not valid in an identifier 38 | d2 = a[v[j].ind].s * dist(a[i], v[i1]); | ^ countries.cpp:38:8: error: extended character is not valid in an identifier 38 | d2 = a[v[j].ind].s * dist(a[i], v[i1]); | ^ countries.cpp:38:11: error: extended character is not valid in an identifier 38 | d2 = a[v[j].ind].s * dist(a[i], v[i1]); | ^ countries.cpp:38:14: error: extended character is not valid in an identifier 38 | d2 = a[v[j].ind].s * dist(a[i], v[i1]); | ^ countries.cpp:39:2: error: extended character is not valid in an identifier 39 | if (d1 > d2) { | ^ countries.cpp:39:5: error: extended character is not valid in an identifier 39 | if (d1 > d2) { | ^ countries.cpp:39:8: error: extended character is not valid in an identifier 39 | if (d1 > d2) { | ^ countries.cpp:39:11: error: extended character is not valid in an identifier 39 | if (d1 > d2) { | ^ countries.cpp:39:14: error: extended character is not valid in an identifier 39 | if (d1 > d2) { | ^ countries.cpp:39:17: error: extended character is not valid in an identifier 39 | if (d1 > d2) { | ^ countries.cpp:40:2: error: extended character is not valid in an identifier 40 | i1 = j; i2 = -1; | ^ countries.cpp:40:5: error: extended character is not valid in an identifier 40 | i1 = j; i2 = -1; | ^ countries.cpp:40:8: error: extended character is not valid in an identifier 40 | i1 = j; i2 = -1; | ^ countries.cpp:40:11: error: extended character is not valid in an identifier 40 | i1 = j; i2 = -1; | ^ countries.cpp:40:14: error: extended character is not valid in an identifier 40 | i1 = j; i2 = -1; | ^ countries.cpp:40:17: error: extended character is not valid in an identifier 40 | i1 = j; i2 = -1; | ^ countries.cpp:40:20: error: extended character is not valid in an identifier 40 | i1 = j; i2 = -1; | ^ countries.cpp:40:23: error: extended character is not valid in an identifier 40 | i1 = j; i2 = -1; | ^ countries.cpp:41:2: error: extended character is not valid in an identifier 41 | } | ^ countries.cpp:41:5: error: extended character is not valid in an identifier 41 | } | ^ countries.cpp:41:8: error: extended character is not valid in an identifier 41 | } | ^ countries.cpp:41:11: error: extended character is not valid in an identifier 41 | } | ^ countries.cpp:41:14: error: extended character is not valid in an identifier 41 | } | ^ countries.cpp:41:17: error: extended character is not valid in an identifier 41 | } | ^ countries.cpp:42:2: error: extended character is not valid in an identifier 42 | if (d1 == d2) { | ^ countries.cpp:42:5: error: extended character is not valid in an identifier 42 | if (d1 == d2) { | ^ countries.cpp:42:8: error: extended character is not valid in an identifier 42 | if (d1 == d2) { | ^ countries.cpp:42:11: error: extended character is not valid in an identifier 42 | if (d1 == d2) { | ^ countries.cpp:42:14: error: extended character is not valid in an identifier 42 | if (d1 == d2) { | ^ countries.cpp:42:17: error: extended character is not valid in an identifier 42 | if (d1 == d2) { | ^ countries.cpp:43:2: error: extended character is not valid in an identifier 43 | i2 = j; continue; | ^ countries.cpp:43:5: error: extended character is not valid in an identifier 43 | i2 = j; continue; | ^ countries.cpp:43:8: error: extended character is not valid in an identifier 43 | i2 = j; continue; | ^ countries.cpp:43:11: error: extended character is not valid in an identifier 43 | i2 = j; continue; | ^ countries.cpp:43:14: error: extended character is not valid in an identifier 43 | i2 = j; continue; | ^ countries.cpp:43:17: error: extended character is not valid in an identifier 43 | i2 = j; continue; | ^ countries.cpp:43:20: error: extended character is not valid in an identifier 43 | i2 = j; continue; | ^ countries.cpp:43:23: error: extended character is not valid in an identifier 43 | i2 = j; continue; | ^ countries.cpp:43:32: error: extended character is not valid in an identifier 43 | i2 = j; continue; | ^ countries.cpp:45:2: error: extended character is not valid in an identifier 45 | } | ^ countries.cpp:45:5: error: extended character is not valid in an identifier 45 | } | ^ countries.cpp:45:8: error: extended character is not valid in an identifier 45 | } | ^ countries.cpp:45:11: error: extended character is not valid in an identifier 45 | } | ^ countries.cpp:46:2: error: extended character is not valid in an identifier 46 | if (~i2) { | ^ countries.cpp:46:5: error: extended character is not valid in an identifier 46 | if (~i2) { | ^ countries.cpp:46:8: error: extended character is not valid in an identifier 46 | if (~i2) { | ^ countries.cpp:46:11: error: extended character is not valid in an identifier 46 | if (~i2) { | ^ countries.cpp:47:2: error: extended character is not valid in an identifier 47 | ans[a[i].ind] = "D"; continue; | ^ countries.cpp:47:5: error: extended character is not valid in an identifier 47 | ans[a[i].ind] = "D"; continue; | ^ countries.cpp:47:8: error: extended character is not valid in an identifier 47 | ans[a[i].ind] = "D"; continue; | ^ countries.cpp:47:11: error: extended character is not valid in an identifier 47 | ans[a[i].ind] = "D"; continue; | ^ countries.cpp:47:14: error: extended character is not valid in an identifier 47 | ans[a[i].ind] = "D"; continue; | ^ countries.cpp:48:2: error: extended character is not valid in an identifier 48 | } | ^ countries.cpp:48:5: error: extended character is not valid in an identifier 48 | } | ^ countries.cpp:48:8: error: extended character is not valid in an identifier 48 | } | ^ countries.cpp:48:11: error: extended character is not valid in an identifier 48 | } | ^ countries.cpp:49:2: error: extended character is not valid in an identifier 49 | if (ans[v[i1].ind] != "K") { | ^ countries.cpp:49:5: error: extended character is not valid in an identifier 49 | if (ans[v[i1].ind] != "K") { | ^ countries.cpp:49:8: error: extended character is not valid in an identifier 49 | if (ans[v[i1].ind] != "K") { | ^ countries.cpp:50:2: error: extended character is not valid in an identifier 50 | ans[a[i].ind] = ans[v[i1].ind]; continue; | ^ countries.cpp:50:5: error: extended character is not valid in an identifier 50 | ans[a[i].ind] = ans[v[i1].ind]; continue; | ^ countries.cpp:50:8: error: extended character is not valid in an identifier 50 | ans[a[i].ind] = ans[v[i1].ind]; continue; | ^ countries.cpp:50:11: error: extended character is not valid in an identifier 50 | ans[a