4414 | 2023-03-27 18:41:46 | balaaaazs | Ősi szöveg | cpp14 | Wrong answer 15/100 | 248ms | 522996 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
vector<string> S(N);
for (int i = 0; i < N; i++) {
cin >> S[i];
}
vector<vector<int>> dist(N, vector<int>(N, 0));
for (int i = 0; i < N; i++) {
for (int j = i + 1; j < N; j++) {
int d = 0;
for (int k = 0; k < K; k++) {
d += (S[i][k] ^ S[j][k]) & 1;
}
dist[i][j] = d;
dist[j][i] = d;
}
}
vector<double> avgdist(N, 0.0);
double divisor = N - 1;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
if (i != j) {
avgdist[i] += dist[i][j];
}
}
avgdist[i] /= divisor;
}
int min_index = min_element(avgdist.begin(), avgdist.end()) - avgdist.begin();
cout << min_index << endl;
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1808 KiB | ||||
2 | Accepted | 3ms | 2060 KiB | ||||
subtask2 | 4/4 | ||||||
3 | Accepted | 3ms | 2272 KiB | ||||
4 | Accepted | 3ms | 2428 KiB | ||||
5 | Accepted | 7ms | 3184 KiB | ||||
subtask3 | 11/11 | ||||||
6 | Accepted | 3ms | 2984 KiB | ||||
7 | Accepted | 3ms | 3136 KiB | ||||
8 | Accepted | 8ms | 3916 KiB | ||||
9 | Accepted | 8ms | 4064 KiB | ||||
10 | Accepted | 8ms | 4276 KiB | ||||
subtask4 | 0/21 | ||||||
11 | Accepted | 3ms | 3604 KiB | ||||
12 | Accepted | 3ms | 3976 KiB | ||||
13 | Wrong answer | 3ms | 3932 KiB | ||||
14 | Wrong answer | 3ms | 3932 KiB | ||||
15 | Accepted | 3ms | 3928 KiB | ||||
16 | Accepted | 3ms | 3980 KiB | ||||
subtask5 | 0/25 | ||||||
17 | Accepted | 28ms | 5740 KiB | ||||
18 | Accepted | 68ms | 6708 KiB | ||||
19 | Runtime error | 196ms | 522996 KiB | ||||
20 | Runtime error | 202ms | 522756 KiB | ||||
21 | Runtime error | 248ms | 522728 KiB | ||||
22 | Runtime error | 248ms | 522700 KiB | ||||
23 | Runtime error | 204ms | 522460 KiB | ||||
subtask6 | 0/39 | ||||||
24 | Accepted | 28ms | 6452 KiB | ||||
25 | Accepted | 68ms | 7568 KiB | ||||
26 | Runtime error | 196ms | 521972 KiB | ||||
27 | Runtime error | 201ms | 521752 KiB | ||||
28 | Runtime error | 206ms | 521532 KiB | ||||
29 | Runtime error | 202ms | 521520 KiB | ||||
30 | Runtime error | 246ms | 521488 KiB | ||||
31 | Runtime error | 203ms | 521492 KiB |