# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
473169 | ZaZo_ | Genetics (BOI18_genetics) | C++14 | 2081 ms | 139052 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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<set<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].insert({x,i});
}
}
for(int i = 0 ; i < m ; i ++)
{
set<int>ad;
auto itt = v[i].begin();
for(; itt!=v[i].end() ; itt++)
{
if((*itt).first=='A')
ad.insert((*itt).second);
else
{
if(ad.size())
{
auto it=ad.begin();
for(;it!=ad.end();it++)
{
ans[(*itt).second].insert(*it);
ans[*it].insert((*itt).second);
}
}
}
}
}
for(int i = 0 ; i < n ; i++)
{
if(ans[i].size()==k*(n-1)) {cout<<i+1<<endl; return 0;}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |