QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#507236#5254. Differencesucup-team1525#RE 0ms0kbC++171.2kb2024-08-06 14:16:362024-08-06 14:16:36

Judging History

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

  • [2024-08-06 14:16:36]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-08-06 14:16:36]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=100005;
string s[N];
int n,m,K;
mt19937 rnd(19260817);
#define ll long long
ll a[N][4];
int main()
{
    // scanf("%d%d%d",&n,&m,&K);
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n>>m>>K;
    for (int i=1;i<=n;++i)
    {
        cin>>s[i];
        for (int j=0;j<m;++j)
            a[j][s[i][j]-'A']++;
    }
    vector<int> v;
    for (int i=1;i<=n;++i)
    {
        int sum=0;
        for (int j=0;j<m;++j)
            sum+=(n-a[j][s[i][j]-'A']);
        if (sum==(n-1)*K)
            v.push_back(i);
    }
    while (v.size()!=1)
    {
        ll rndsum=0;
        for (int i=0;i<m;++i)
            for (int j=0;j<4;++j)
                a[i][j]=0;
        for (int i=1;i<=n;++i)
        {
            v[i]=rnd();
            rndsum+=v[i];
            for (int j=0;j<m;++j)
                a[j][s[i][j]-'A']+=v[i];
        }
        vector<int> v2;
        for (int x:v)
        {
            ll sum=0;
            for (int j=0;j<m;++j)
                sum+=(rndsum-a[j][s[x][j]-'A']);
            if (sum==(rndsum-v[x])*K)
                v2.push_back(x);
        }
        v=v2;
    }
    printf("%d\n",v[0]);
    return 0;
}

詳細信息

Test #1:

score: 0
Runtime Error

input:

3585 4096 2048
ABBBBBBAABAAAAAAAAAAAAABAABABBBABABAAAAABABAAAABAABAABBABBAABAABABBABAABBABBABABABBAAAABBABAABBBBABBBAABBBBBABAABAAABAAABBBBAAAABAABAABABABABBBBBABAAABAAABBAABABBABAABBAABBAABABBBBAABAAAABAABBABAAABBAAAAAABAABBABBABAABABBBAABABBABABBBAAAAABBBABABABBAABAAAABBBBABABAABBBABABABBAABBBABAB...

output:


result: