Submission #473155

#TimeUsernameProblemLanguageResultExecution timeMemory
473155ZaZo_Genetics (BOI18_genetics)C++14
0 / 100
2109 ms603228 KiB
#include <bits/stdc++.h> #define ZAZO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define int long long using namespace std; int n , m , k; int32_t main() { ZAZO cin >> n >> m >> k; vector<pair<char,int>>v[m]; vector<multiset<int>>ans(n); for(int i = 0 ; i < n ; i ++) { for(int j = 0 ; j < m ; j ++) { char x; cin>>x; v[j].push_back({x,i}); } } for(int i = 0 ; i < m ; i ++) { multiset<int>ad,ad2; int flg=-1; sort(v[i].begin(),v[i].end()); for(int j = 0 ; j < n ; j ++) { if(v[i][j].first=='A') ad.insert(v[i][j].second); else { ad2.insert(v[i][j].second); if(flg==-1) flg=j; if(ad.size()) { auto it=ad.begin(); for(;it!=ad.end();it++) { ans[v[i][j].second].insert(*it); } } } } for(int j = flg-1 ; j>=0 ; j--) { if(ad2.size()) { auto it=ad2.begin(); for(;it!=ad2.end();it++) { ans[v[i][j].second].insert(*it); } } } } for(int i = 0 ; i < n ; i++) { int prev=0; auto it=ans[i].begin(); prev=*it; int cnt=0; for(;it!=ans[i].end();it++) { if(prev!=*it) { if(cnt!=k){ cnt=-1; break; } cnt=1; } else cnt++; prev=*it; } if(cnt!=-1) {cout<<i+1<<endl; break;} } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...