제출 #777894

#제출 시각아이디문제언어결과실행 시간메모리
777894TheSahibGenetics (BOI18_genetics)C++14
46 / 100
1974 ms19784 KiB
#include <bits/stdc++.h>
 
#pragma GCC target("popcnt")
 
#define ll long long
#define oo 1e9
#define pii pair<int, int>
 
using namespace std;
 
const int MAX = 1 << 12;
 
int n, m, k; 
bitset<MAX> st[MAX][4];
 
int comp(int a, int b){
    int cnt = 0;
    for (int i = 0; i < 4; i++)
    {
        cnt += (st[a][i] & st[b][i]).count();
    }
    return m - cnt;
}

int ans[MAX];
 
void solve(){
    scanf("%d%d%d", &n, &m, &k);
    for (int i = 0; i < n; i++)
    {
        getchar();
        for (int j = 0; j < m; j++)
        {
            char c = getchar();
            if(c == 'G') c = 'B';
            if(c == 'T') c = 'D';
            st[i][c - 'A'][j] = 1;
        }
    }
    
    vector<int> v;
    v.resize(n);
    iota(v.begin(), v.end(), 0);
    random_shuffle(v.begin(), v.end());
    
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            if(comp(v[i], v[j]) == k){
                ans[v[i]]++;
                ans[v[j]]++;
            }
        }
        if(ans[v[i]] == n - 1){
            cout << v[i] + 1 << '\n';
            return;
        }
    }
}
 
int main()
{
    solve();
}

컴파일 시 표준 에러 (stderr) 메시지

genetics.cpp: In function 'void solve()':
genetics.cpp:28:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |     scanf("%d%d%d", &n, &m, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...