QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#190868 | #5254. Differences | ucup-team902# | WA | 90ms | 23808kb | C++17 | 1004b | 2023-09-29 14:59:00 | 2023-09-29 14:59:00 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int n, m, k;
const int mod = 1e9 + 7;
string s[100005];
int x[100005];
random_device rd;
mt19937 gen(rd());
uniform_int_distribution<> dis(1, (int)1e9);
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> m >> k;
for (int i = 1; i <= n; ++i)
cin >> s[i];
int tot = 0;
for (int i = 1; i <= n; ++i) {
x[i] = dis(gen);
tot = (tot + x[i]) % mod;
}
vector<vector<int>> c(m + 1, vector<int>(4, 0));
for (int i = 1; i <= n; ++i) {
for (int j = 0; j < m; ++j) {
c[j][s[i][j] - 'A'] = (c[j][s[i][j] - 'A'] + x[i]) % mod;
}
}
for (int i = 1; i <= n; ++i) {
int now = 0;
for (int j = 0; j < m; ++j) {
now = (now + tot - c[j][s[i][j] - 'A'] + mod) % mod;
}
if (now == 1ll * (tot - x[i] + mod) % mod * k % mod) {
cout << i << endl;
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 90ms
memory: 23808kb
input:
3585 4096 2048 ABBBBBBAABAAAAAAAAAAAAABAABABBBABABAAAAABABAAAABAABAABBABBAABAABABBABAABBABBABABABBAAAABBABAABBBBABBBAABBBBBABAABAAABAAABBBBAAAABAABAABABABABBBBBABAAABAAABBAABABBABAABBAABBAABABBBBAABAAAABAABBABAAABBAAAAAABAABBABBABAABABBBAABABBABABBBAAAAABBBABABABBAABAAAABBBBABABAABBBABABABBAABBBABAB...
output:
result:
wrong answer 1st lines differ - expected: '1397', found: ''