Submission #202663

#TimeUsernameProblemLanguageResultExecution timeMemory
202663karmaGenetics (BOI18_genetics)C++14
100 / 100
407 ms66680 KiB
#include<bits/stdc++.h> #define ll long long #define pb emplace_back #define fi first #define se second #define mp make_pair //#define int int64_t using namespace std; typedef pair<ll, ll> pii; typedef unsigned int ui; const int N = 4103; const ui base = 13; ui p[N], sum[N][4]; int n, m, k, a[N][N]; string s; int Code(char c) { if(c == 'A') return 1; if(c == 'C') return 2; if(c == 'T') return 3; return 0; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define FileName "test" if(fopen(FileName".inp", "r")) { freopen(FileName".inp", "r", stdin); freopen(FileName".out", "w", stdout); } cin >> n >> m >> k; p[0] = 1; for(int i = 1; i <= n; ++i) { p[i] = p[i - 1] * base; cin >> s; for(int j = 0; j < m; ++j) { a[i][j] = Code(s[j]); sum[j][a[i][j]] += p[i]; } } ui cur, ss; for(int i = 1; i <= n; ++i) { cur = ss = 0; for(int j = 1; j <= n; ++j) if(i != j) cur += p[j] * (ui)k; for(int j = 0; j < m; ++j) { for(int t = 0; t < 4; ++t) { if(t != a[i][j]) ss += sum[j][t]; } } if(cur == ss) return cout << i, 0; } }

Compilation message (stderr)

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