Submission #1034501

#TimeUsernameProblemLanguageResultExecution timeMemory
1034501anangoGenetics (BOI18_genetics)C++17
0 / 100
36 ms7880 KiB
#include <bits/stdc++.h> #define int long long using namespace std; int INF = 1LL<<30; int match(string &s1, string &s2) { int ct=0; for (int i=0; i<s1.size(); i++) { ct+=s1[i]!=s2[i]; } return ct; } signed main() { /*#ifndef ONLINE_JUDGE // for getting input from input.txt freopen("input.txt", "r", stdin); // for writing output to output.txt freopen("output.txt", "w", stdout); #endif*/ //ios_base::sync_with_stdio(false); //cin.tie(NULL); int n,m,k; cin >> n >> m >> k; vector<string> ar(n); vector<int> order(n); vector<int> visited(n,0); for (int i=0; i<n; i++) { int r = (rand()+rand()+rand())%n; while (visited[r]) { r = rand()%n; r+=rand(); r%=n; } visited[r] = 1; order[i] = r; //cout << i <<" " <<r << endl; } for (int i=0; i<n; i++) { cin >> ar[i]; } for (int i=0; i<n; i++) { int gg = 1; for (int j=0; j<n; j++) { if (order[i]==order[j]) continue; if (match(ar[order[i]],ar[order[j]])!=k) { gg=0; break; } } if (gg) { cout << order[i]+1 << endl; break; } } }

Compilation message (stderr)

genetics.cpp: In function 'long long int match(std::string&, std::string&)':
genetics.cpp:8:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     for (int i=0; i<s1.size(); i++) {
      |                   ~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...