제출 #94323

#제출 시각아이디문제언어결과실행 시간메모리
94323dalgerokGenetics (BOI18_genetics)C++14
0 / 100
158 ms6520 KiB
#include<bits/stdc++.h> #define int long long using namespace std; const int N = 4105; const char letters[] = {'A', 'C', 'G', 'T'}; int n, m, k, val[N], sum, d[N][4]; char a[N][N]; inline bool check(int num){ for(int i = 1; i <= n; i++){ if(i == num){ continue; } int cur = 0; for(int j = 1; j <= m; j++){ cur += (a[num][j] != a[i][j]); } if(cur != k){ return false; } } return true; } main(){ srand(time(nullptr)); ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin >> n >> m >> k; for(int i = 1; i <= n; i++){ val[i] = (rand() ^ (rand() << 15)); sum += val[i]; for(int j = 1; j <= m; j++){ cin >> a[i][j]; } } for(int it = 0; it < 4; it++){ for(int j = 1; j <= n; j++){ for(int i = 1; i <= n; i++){ if(a[i][j] == letters[it]){ d[j][it] += val[i]; } } } } vector < int > q; for(int i = 1; i <= n; i++){ int cur = 0; for(int j = 1; j <= m; j++){ for(int l = 0; l < 4; l++){ if(a[i][j] == letters[l]){ cur += (sum - d[j][l]); } } } if(cur == k * (sum - val[i])){ q.push_back(i); } } for(int i = 0; i < (int)q.size(); i++){ if(check(q[i])){ return cout << q[i], 0; } } }

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

genetics.cpp:31:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...