QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#293982 | #5254. Differences | LaStataleBlue# | TL | 0ms | 0kb | C++23 | 1.0kb | 2023-12-30 01:26:56 | 2023-12-30 01:26:57 |
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...