QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#71370 | #5254. Differences | Sorting# | TL | 592ms | 23308kb | C++ | 634b | 2023-01-09 21:03:12 | 2023-01-09 21:03:15 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
int n,m,k;
string s[100001];
int p[100001];
int main(){
ios::sync_with_stdio(false);cin.tie(0);
cin >> n >> m >> k;
for(int i=1; i<=n ;i++){
cin >> s[i];
p[i]=i;
}
random_shuffle(p+1,p+n+1);
for(int i=1; i<=n ;i++){
bool fail=false;
for(int j=1; j<=n ;j++){
if(i==p[j]) continue;
int x=0;
for(int k=0; k<m ;k++) x+=s[i][k]!=s[p[j]][k];
//cout << i << ' ' << p[j] << ' ' << x << endl;
if(x!=k){
fail=true;
break;
}
}
if(!fail) return cout << i << '\n',0;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 592ms
memory: 23308kb
input:
3585 4096 2048 ABBBBBBAABAAAAAAAAAAAAABAABABBBABABAAAAABABAAAABAABAABBABBAABAABABBABAABBABBABABABBAAAABBABAABBBBABBBAABBBBBABAABAAABAAABBBBAAAABAABAABABABABBBBBABAAABAAABBAABABBABAABBAABBAABABBBBAABAAAABAABBABAAABBAAAAAABAABBABBABAABABBBAABABBABABBBAAAAABBBABABABBAABAAAABBBBABABAABBBABABABBAABBBABAB...
output:
1397
result:
ok single line: '1397'
Test #2:
score: -100
Time Limit Exceeded
input:
4099 4100 2 ABABBAAABBBABBBAABAAAAABABBBBBAAAAABBABBBBABBAAABBAABAAAAAAAAABBABAABAABBAAABAAAABBAABBBBABAAABAABABBAAABBBBBABABBBBBABBABBAABBBABAAABBABBBBAAAABAABBAABAABABABAAABAAAAABAABABBBAAAABBBBBBBABBBAABABBABABBBABAAAAABBBBABAAABABBBAABBAABBBABBABBBABBAABABBABBBBABBBABAABBBAAABAABAABBABAAABABABAB...