QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#293982#5254. DifferencesLaStataleBlue#TL 0ms0kbC++231.0kb2023-12-30 01:26:562023-12-30 01:26:57

Judging History

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

  • [2023-12-30 01:26:57]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2023-12-30 01:26:56]
  • 提交

answer

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

mt19937 rng((uint64_t) chrono::duration_cast<chrono::
    nanoseconds>(chrono::high_resolution_clock::now()
        .time_since_epoch()).count());

void solve(int t){
    int n,m,k;
    cin>>n>>m>>k;
    
    vector<pair<string,int>> v(n);
    for(int i=0;i<n;i++){
        cin>>v[i].first;
        v[i].second=i+1;
    }
    
    shuffle(v.begin(),v.end(),rng);
    
    for(int i=0;i<n;i++){
        bool ok=true;
        for(int j=0;j<n;j++){
            if(i==j)continue;
            
            int cont=0;
            for(int x=0;x<m;x++){
                if(v[i].first[x]!=v[j].first[x])cont++;
            }
            
            if(cont!=k){
                ok=false;
                break;
            }
        }
        
        if(ok){
            cout<<v[i].second<<"\n";
            return;
        }
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int t=1;
    //cin>>t;
    for(int i=1;i<=t;i++)solve(i);
    
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Time Limit Exceeded

input:

3585 4096 2048
ABBBBBBAABAAAAAAAAAAAAABAABABBBABABAAAAABABAAAABAABAABBABBAABAABABBABAABBABBABABABBAAAABBABAABBBBABBBAABBBBBABAABAAABAAABBBBAAAABAABAABABABABBBBBABAAABAAABBAABABBABAABBAABBAABABBBBAABAAAABAABBABAAABBAAAAAABAABBABBABAABABBBAABABBABABBBAAAAABBBABABABBAABAAAABBBBABABAABBBABABABBAABBBABAB...

output:


result: