제출 #945204

#제출 시각아이디문제언어결과실행 시간메모리
945204LucaIlieGenetics (BOI18_genetics)C++17
100 / 100
448 ms52200 KiB
#include <bits/stdc++.h> using namespace std; const int MAX_N = 4100; const int MAX_M = 4100; string s[MAX_N]; long long frecv[MAX_N][128], w[MAX_N]; int main() { int n, m, k; long long sum = 0; cin >> n >> m >> k; for ( int i = 0; i < n; i++ ) { cin >> s[i]; w[i] = rand() % INT_MAX; for ( int j = 0; j < m; j++ ) frecv[j][s[i][j]] += w[i]; sum += w[i]; } for ( int i = 0; i < n; i++ ) { long long d = 0; for ( int j = 0; j < m; j++ ) d += sum - frecv[j][s[i][j]]; if ( d == (sum - w[i]) * k ) { bool ok = true; for ( int j = 0; j < n && ok; j++ ) { if ( i == j ) continue; int d = 0; for ( int p = 0; p < m; p++ ) d += (s[i][p] != s[j][p]); if ( d != k ) ok = false; } if ( ok ) { cout << i + 1 << "\n"; return 0; } } } return 0; }

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

genetics.cpp: In function 'int main()':
genetics.cpp:20:29: warning: array subscript has type 'char' [-Wchar-subscripts]
   20 |             frecv[j][s[i][j]] += w[i];
      |                             ^
genetics.cpp:28:40: warning: array subscript has type 'char' [-Wchar-subscripts]
   28 |             d += sum - frecv[j][s[i][j]];
      |                                        ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...