제출 #202676

#제출 시각아이디문제언어결과실행 시간메모리
202676karmaGenetics (BOI18_genetics)C++14
0 / 100
6 ms888 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; const int N = 4500; ll k, cur = 0, ss; int n, m; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); 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; vector<string> s(n); vector<vector<ll>> sum(n, vector<ll>(4)); vector<ll> ssum(n), p(n); for(int i = 0; i < n; ++i) { p[i] = uniform_int_distribution<ll>((ll)1e9, (ll)1e11)(rng); cin >> s[i]; for(int j = 0; j < m; ++j) sum[j][Code(s[i][j])] += p[i]; cur += p[i] * k; } for(int i = 0; i < m; ++i) { ssum[i] = 0; for(int j = 0; j < 4; ++j) ssum[i] += sum[i][j]; } for(int i = 0; i < n; ++i) { ss = 0; for(int j = 0; j < m; ++j) ss += (ssum[j] - sum[j][Code(s[i][j])]); if(cur - p[i] * k == ss) return cout << i + 1, 0; } }

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

genetics.cpp: In function 'int main()':
genetics.cpp:30: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:31: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...