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;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef long long ll;
int n, m, k, score[4150], validCount;
string codes[4150];
bitset<4150> isValid;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
Tree<int> oset;
cin >> n >> m >> k;
for (int i = 0; i < n; i++) {
cin >> codes[i];
oset.insert(i);
}
srand(123);
while (oset.size() > 1) {
int i = rand() % n, j = rand() % n;
if (i == j) continue;
i = *oset.find_by_order(i);
j = *oset.find_by_order(j);
int diffCount = 0;
for (int c = 0; c < m; c++) if (codes[i][c] != codes[j][c]) diffCount++;
if (diffCount != k) {
if (n % 2) { oset.erase(i); n--; }
oset.erase(j);
n--;
}
}
//for (int i = 0; i < n; i++) cerr << "// score[" << i << "] : " << score[i] << '\n';
cout << *oset.begin() + 1 << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |