# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
153138 | 2019-09-12T15:14:22 Z | Swan | Genetics (BOI18_genetics) | C++14 | 179 ms | 3064 KB |
#include <bits/stdc++.h> #define stop system("pause") #define INP freopen("input.txt","r",stdin) #define OUTP freopen("solve1.txt","w",stdout) using namespace std; typedef long long ll; const int maxn = 4111; int cnt[maxn][5]; int n,m,k; bool cmp(string& a,string& b){ int res = 0; for(int i(0); i < a.size();i++){ if(a[i]!=b[i])res++; } return res == k; } int get_num(char c){ if(c == 'A')return 0; if(c == 'C')return 1; if(c == 'T')return 2; return 3; } main() { ios_base::sync_with_stdio(0); cin >> n >> m >> k; int need = (n-1)*k; vector<string> v; for(int i(0); i < n;i++){ string s; cin >> s; v.push_back(s); for(int j(0); j < s.size();j++){ cnt[j][get_num(s[j])]++; } } sort(v.begin(),v.end()); for(int i(0); i < n;i++){ int all = 0; for(int j(0); j < v[i].size();j++){ int now = get_num(v[i][j]); for(int e(0); e < 4;e++){ if(e == now)continue; all+=cnt[j][e]; } } //cout << i+1 << ' ' << all << ' ' << need << endl; if(all!=need)continue; bool f = 1; for(int j(0); j < n;j++){ if(i == j)continue; if(!cmp(v[i],v[j])){ f = 0; break; } } if(f){ cout << i+1; return 0; } } return 0; } /* */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 179 ms | 3064 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 179 ms | 3064 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |