QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#190868#5254. Differencesucup-team902#WA 90ms23808kbC++171004b2023-09-29 14:59:002023-09-29 14:59:00

Judging History

你现在查看的是最新测评结果

  • [2023-09-29 14:59:00]
  • 评测
  • 测评结果:WA
  • 用时:90ms
  • 内存:23808kb
  • [2023-09-29 14:59:00]
  • 提交

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: ''