QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#288052 | #5254. Differences | AtomAlpaca | WA | 236ms | 34684kb | C++14 | 715b | 2023-12-21 17:28:37 | 2023-12-21 17:28:38 |
Judging History
answer
#include <bits/stdc++.h>
typedef long long ll;
const int MAX = 1e5 + 5;
const ll MOD = 1e17 + 3;
const ll P = 7;
std::string s[MAX];
ll n, m, k, sum;
ll w[MAX], f[MAX][5];
std::mt19937 rnd(time(0));
int main()
{
scanf("%lld%lld%lld", &n, &m, &k); w[0] = 1;
for (int i = 1; i <= n; ++i) { w[i] = w[i - 1] * P % MOD; sum = (sum + w[i]) % MOD; }
for (int i = 1; i <= n; ++i)
{
std::cin >> s[i];
for (int j = 0; j < m; ++j)
{
f[j][s[i][j] - 'A'] = (f[j][s[i][j] - 'A'] + w[i]) % MOD;
}
}
for (int i = 1; i <= n; ++i)
{
ll res = sum * m;
for (int j = 0; j < m; ++j)
{
res = (res - f[j][s[i][j] - 'A'] + MOD) % MOD;
}
if (res == (sum - w[i]) * k % MOD) { printf("%d", i); break; }
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 236ms
memory: 34684kb
input:
3585 4096 2048 ABBBBBBAABAAAAAAAAAAAAABAABABBBABABAAAAABABAAAABAABAABBABBAABAABABBABAABBABBABABABBAAAABBABAABBBBABBBAABBBBBABAABAAABAAABBBBAAAABAABAABABABABBBBBABAAABAAABBAABABBABAABBAABBAABABBBBAABAAAABAABBABAAABBAAAAAABAABBABBABAABABBBAABABBABABBBAAAAABBBABABABBAABAAAABBBBABABAABBBABABABBAABBBABAB...
output:
result:
wrong answer 1st lines differ - expected: '1397', found: ''