QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#90524#5254. DifferencesSolitaryDream#WA 41ms61760kbC++201.2kb2023-03-23 14:33:372023-03-23 14:33:38

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-23 14:33:38]
  • 评测
  • 测评结果:WA
  • 用时:41ms
  • 内存:61760kb
  • [2023-03-23 14:33:37]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

const int N=1e5+1e3+7,L=25;

int n,m,k;

int cnt[L+1][N][4],all[N];

bool cho[L+1][N];

string s[N];

mt19937_64 rng(58);

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>m>>k;
    for(int i=1;i<=n;i++)
        cin>>s[i],s[i]=' '+s[i];
    for(int i=1;i<=L;i++)
    {
        int b=64;
        unsigned long long w=-1;
        for(int j=1;j<=n;j++)
        {
            if(b==64)
                w=rng(),b=0;
            b--;
            cho[i][j]=w&1;
            // printf("%d%c",cho[i][j]," \n"[j==n]);
            w>>=1;
        }
    }
    for(int i=1;i<=L;i++)
        for(int j=1;j<=n;j++)
            if(cho[i][j])
                for(int k=1;k<=m;k++)
                    cnt[i][k][s[j][k]-'A']++,all[i]++;
    for(int i=1;i<=n;i++)
    {
        bool ok=1;
        for(int j=1;j<=L;j++)
        {
            int S=all[j];
            for(int k=1;k<=m;k++)
                S-=cnt[j][k][s[i][k]-'A'];
            int R=(all[j]-cho[j][i]*m)/m*k;
            if(S!=R)
            {
                ok=0;
                break;
            }
        }
        if(!ok)
            continue;
        cout<<i<<endl;
        return 0;
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 41ms
memory: 61760kb

input:

3585 4096 2048
ABBBBBBAABAAAAAAAAAAAAABAABABBBABABAAAAABABAAAABAABAABBABBAABAABABBABAABBABBABABABBAAAABBABAABBBBABBBAABBBBBABAABAAABAAABBBBAAAABAABAABABABABBBBBABAAABAAABBAABABBABAABBAABBAABABBBBAABAAAABAABBABAAABBAAAAAABAABBABBABAABABBBAABABBABABBBAAAAABBBABABABBAABAAAABBBBABABAABBBABABABBAABBBABAB...

output:

1

result:

wrong answer 1st lines differ - expected: '1397', found: '1'