Submission #871954

#TimeUsernameProblemLanguageResultExecution timeMemory
871954ThMinh_Genetics (BOI18_genetics)C++14
0 / 100
59 ms19536 KiB
#include<bits/stdc++.h> using namespace std; const int N = 1e5 + 10; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); //mt19937 rng(192374385783); int n, m, k; int p[N], tr[26][N]; bool vis[N], res[N]; string s[N]; int rnd(int f, int l) { return f + rng() % (l - f + 1); } int main () { cin.tie(0)->sync_with_stdio(0); if(fopen("Task.inp", "r")) { freopen("Task.inp", "r", stdin); freopen("WA.out", "w", stdout); } cin>>n>>m>>k; for(int i = 1; i <= n; ++i) cin>>s[i]; for(int i = 1; i <= n; ++i) { p[i] = i; res[i] = 1; } shuffle(p + 1, p + n + 1, rng); for(int timer = 1; timer <= 10; ++timer) { int t = rnd(1, n); // cout<<t<<" "; for(int i = 1; i <= n; ++i) vis[i] = 0; for(int j = 1; j <= m; ++j) for(int o = 0; o <= 25; ++o) { tr[o][j] = 0; } for(int i = 1; i <= n; ++i) vis[p[i]] = (i <= t); // for(int i = 1; i <= n; ++i) cout<<vis[i]<<" "; cout<<"\n"; for(int i = 1; i <= t; ++i) for(int j = 1; j <= m; ++j) { int c = s[p[i]][j - 1] - 'A'; tr[c][j]++; } for(int i = 1; i <= n; ++i) { int ans = 0; for(int j = 1; j <= m; ++j) { int c = s[i][j - 1] - 'A'; ans += tr[c][j] - vis[i]; } // cout<<ans<<"\n"; res[i] &= (ans == (t - vis[i]) * (m - k)); } // cout<<"\n\n"; } for(int i = 1; i <= n; ++i) if(res[i]) cout<<i; }

Compilation message (stderr)

genetics.cpp: In function 'int main()':
genetics.cpp:18:14: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |       freopen("Task.inp", "r", stdin);
      |       ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
genetics.cpp:19:14: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |       freopen("WA.out", "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...