QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#369008 | #5254. Differences | qq11123334# | WA | 215ms | 62864kb | C++20 | 1.7kb | 2024-03-27 19:20:07 | 2024-03-27 19:20:09 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const int N = 100005;
ll cnt1[N][4], cnt2[N][4], cnt3[N][4];
vector<vector<int>> v;
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
int n, m, k;
cin >> n >> m >> k;
v.resize(n + 1);
for(int i = 1; i <= n; i++) {
v[i].resize(m);
for(int j = 0; j < m; j++) {
char c;
cin >> c;
v[i][j] = (c - 'A');
}
}
for(int i = 1; i <= n; i++) {
for(int j = 0; j < m; j++) {
cnt1[j][v[i][j]]++;
cnt2[j][v[i][j]] += (i);
cnt3[j][v[i][j]] += (i * i);
}
}
ll check1 = 0;
ll check2 = 0;
ll check3 = 0;
for(int i = 1; i <= n; i++) {
check1 += k;
check2 += i * k;
check3 += (i * i) * k;
}
vector<int> cand;
for(int i = 1; i <= n; i++) {
ll c1 = 0, c2 = 0, c3 = 0;
for(int j = 0; j < m; j++) {
for(int c = 0; c < 4; c++) {
if(v[i][j] == c) continue;
c1 += cnt1[j][c];
c2 += cnt2[j][c];
c3 += cnt3[j][c];
}
}
if(check1 - k == c1 && check2 - i * k == c2 && check3 - i * i * k == c3) cand.push_back(i);
}
for(auto x : cand) {
bool isable = true;
for(int i = 1; i <= n; i++) {
if(i == x) continue;
ll dif = 0;
for(int j = 0; j < m; j++) {
if(v[x][j] != v[i][j]) dif++;
}
if(dif != k) isable = false;
}
if(isable) {
cout << x << "\n";
exit(0);
}
}
}
详细
Test #1:
score: 0
Wrong Answer
time: 215ms
memory: 62864kb
input:
3585 4096 2048 ABBBBBBAABAAAAAAAAAAAAABAABABBBABABAAAAABABAAAABAABAABBABBAABAABABBABAABBABBABABABBAAAABBABAABBBBABBBAABBBBBABAABAAABAAABBBBAAAABAABAABABABABBBBBABAAABAAABBAABABBABAABBAABBAABABBBBAABAAAABAABBABAAABBAAAAAABAABBABBABAABABBBAABABBABABBBAAAAABBBABABABBAABAAAABBBBABABAABBBABABABBAABBBABAB...
output:
result:
wrong answer 1st lines differ - expected: '1397', found: ''