QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#101350 | #5254. Differences | DestroyXuanQuang# | WA | 616ms | 17980kb | C++14 | 1.3kb | 2023-04-29 10:56:34 | 2023-04-29 10:56:35 |
Judging History
answer
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <ctime>
#include <cstdlib>
#include <utility>
int n, m, k;
int cnt[100005][4];
std::vector <std::pair <std::string, int> > a;
int main () {
std::srand (unsigned(std::time(0)));
std::cin >> n >> m >> k;
a.resize(n);
for (int i = 0; i < n; i++) {
std::string s;
std::cin >> s;
a[i] = std::make_pair(s, i);
}
std::random_shuffle(a.begin(), a.end());
for (int j = 0; j < m; j++) {
for (int i = 0; i < n; i++) {
cnt[j][a[i].first[j] - 'A']++;
}
}
for (int i = 0; i < n; i++) {
long long totalDiff = 0;
for (int j = 0; j < m; j++) {
totalDiff += (long long) (n - cnt[j][a[i].first[j] - 'A']);
}
if (totalDiff != (long long) (n - 1) * k) {
continue;
}
bool check = true;
for (int x = 0; x < i; x++) {
if (x != i) {
int numbDiff = 0;
for (int j = 0; j < m; j++) {
if (a[i].first[j] != a[x].first[j]) {
numbDiff++;
}
}
if (numbDiff != k) {
check = false;
break;
}
}
}
if (check == true) {
std::cout << a[i].second + 1;
return 0;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 616ms
memory: 17980kb
input:
3585 4096 2048 ABBBBBBAABAAAAAAAAAAAAABAABABBBABABAAAAABABAAAABAABAABBABBAABAABABBABAABBABBABABABBAAAABBABAABBBBABBBAABBBBBABAABAAABAAABBBBAAAABAABAABABABABBBBBABAAABAAABBAABABBABAABBAABBAABABBBBAABAAAABAABBABAAABBAAAAAABAABBABBABAABABBBAABABBABABBBAAAAABBBABABABBAABAAAABBBBABABAABBBABABABBAABBBABAB...
output:
3087
result:
wrong answer 1st lines differ - expected: '1397', found: '3087'