제출 #593876

#제출 시각아이디문제언어결과실행 시간메모리
593876AlesL0Genetics (BOI18_genetics)C++17
27 / 100
228 ms1064 KiB
#pragma GCC optimize("03") #include <bits/stdc++.h> using namespace std; typedef long long ll; int comp(string a, string b){ int r = 0; for (int i = 0; i < a.size(); i++)if (a[i] != b[i])r++; return r; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n, m, k; cin >> n >> m >> k; if (n <= 100 && m <= 100){ string x[n]; for (int i = 0; i < n; i++)cin >> x[i]; for (int i = 0; i < n; i++){ bool flag10 = 1; for (int j = 0; j < n; j++){ if (i == j)continue; if (comp(x[i], x[j]) != k){ flag10 = 0; break; } } if (flag10){ cout << i+1; break; } } } else { bitset <4100> b[n]; for (int i = 0; i < n; i++){ for (int j = 0; j < m; j++){ char c; cin >> c; if (c == 'A')b[i].set(j); } } vector <bool> good(n, 1); for (int i = 0; i < n; i++){ if (!good[i])continue; for (int j = i+1; j < n; j++){ if ((b[i]^b[j]).count() != k){ good[i] = 0; good[j] = 0; break; } } if (good[i]){ cout << i+1; break; } } } }

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

genetics.cpp: In function 'int comp(std::string, std::string)':
genetics.cpp:11:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for (int i = 0; i < a.size(); i++)if (a[i] != b[i])r++;
      |                     ~~^~~~~~~~~~
genetics.cpp: In function 'int main()':
genetics.cpp:50:41: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   50 |                 if ((b[i]^b[j]).count() != 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...