제출 #1248362

#제출 시각아이디문제언어결과실행 시간메모리
1248362liangjeremyGenetics (BOI18_genetics)C++20
27 / 100
2095 ms3144 KiB
#include<bits/stdc++.h>
#define fi first
#define se second
#define int long long
using namespace std;
using db=double;
using sll=__int128;
using lb=long double; 
 
int32_t main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); srand(time(0));
    int n,m,k; cin>>n>>m>>k; vector<string>a(n+1);
    for(int i=1; i<=n; i++){ cin>>a[i]; }
    int ans=-1;
    for(int i=1; i<=n; i++){
    	bool ok=true;
    	for(int j=1; j<=n; j++){
    		if(i==j)continue;
    		int cnt=0;
    		for(int idx=0; idx<m; idx++){
    			cnt+=(a[i][idx]!=a[j][idx]);
    		}
    		if(cnt!=k)ok=false;
    	}
    	if(ok)ans=i;
    }
    cout<<ans<<'\n'; 
}

/*
O what can ail thee, knight-at-arms,
       Alone and palely loitering?
The sedge has withered from the lake,
       And no birds sing.
 
O what can ail thee, knight-at-arms,
       So haggard and so woe-begone?
The squirrel’s granary is full,
       And the harvest’s done.
 
I see a lily on thy brow,
       With anguish moist and fever-dew,
And on thy cheeks a fading rose
       Fast withereth too. 
*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...