제출 #872055

#제출 시각아이디문제언어결과실행 시간메모리
872055ThMinh_Genetics (BOI18_genetics)C++14
100 / 100
1088 ms59104 KiB
#include<bits/stdc++.h> #define ll long long 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; ll w[N], tr[26][N]; bool 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) res[i] = 1; for(int timer = 1; timer <= 30; ++timer) { ll sum = 0; for(int i = 1; i <= n; ++i) { w[i] = rnd(1, 1e9); sum += w[i]; } 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) for(int j = 1; j <= m; ++j) { int c = s[i][j - 1] - 'A'; tr[c][j] += w[i]; } for(int i = 1; i <= n; ++i) { ll ans = 0; for(int j = 1; j <= m; ++j) { int c = s[i][j - 1] - 'A'; ans += tr[c][j] - w[i]; } res[i] &= (ans == (sum - w[i]) * (m - k)); } } for(int i = 1; i <= n; ++i) if(res[i]) cout<<i; }

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

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