Submission #997733

#TimeUsernameProblemLanguageResultExecution timeMemory
997733MarwenElarbiGenetics (BOI18_genetics)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define ll long long #define pb push_back #define ii pair<int,int> const int nax=5e4+5; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int main(){ #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int n,m,k; cin>>n>>m>>k; string tab[n]; vector<int> per(n); for (int i = 0; i < n; ++i) { per[i]=i; cin>>tab[i]; } shuffle(per.begin(),per.end(),rng); bool vis[n]; memset(vis,0,sizeof vis); int cnt=0; for (int i = 0; i < min(n,10); ++i) { for (int j = 0; j < n; ++j) { if(per[i]==per[j]) continue; int cur=0; for (int t = 0; t < m; ++t) { if(tab[per[i]][t]!=tab[per[j]][t]) cur++; if(cur>k) break; } if(cur!=k){ vis[per[j]]=1; vis[per[i]]=1; } } } for (int i = 0; i < n; ++i) { if(vis[per[i]]==0){ cout <<per[i]+1<<endl; break; } } }

Compilation message (stderr)

genetics.cpp: In function 'int main()':
genetics.cpp:27:9: warning: unused variable 'cnt' [-Wunused-variable]
   27 |     int cnt=0;
      |         ^~~
genetics.cpp:12:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         freopen("input.txt", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
genetics.cpp:13:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         freopen("output.txt", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...