제출 #1093508

#제출 시각아이디문제언어결과실행 시간메모리
1093508ThanhsGenetics (BOI18_genetics)C++14
46 / 100
2039 ms130088 KiB
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define int long long #define endl '\n' #define setmin(x, y) x = ((x) < (y) ? (x) : (y)) #define setmax(x, y) x = ((x) > (y) ? (x) : (y)) mt19937 hdp(chrono::high_resolution_clock::now().time_since_epoch().count()); int rand(int l, int r){return l + ((hdp() % (r - l + 1)) + r - l + 1) % (r - l + 1);} const int NM = 4100 + 5; vector<int> pos; int n, m, k, a[NM][NM], c[NM][4]; void solve() { cin >> n >> m >> k; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) { char t; cin >> t; a[i][j] = (t == 'A' ? 0 : t == 'C' ? 1 : t == 'G' ? 2 : 3); c[j][a[i][j]]++; } for (int i = 1; i <= n; i++) { int sum = 0; for (int j = 1; j <= m; j++) sum += n - c[j][a[i][j]]; if (sum == (n - 1) * k) pos.push_back(i); } shuffle(pos.begin(), pos.end(), hdp); while (!pos.empty()) { int t = pos.back(); pos.pop_back(); bool b = 1; for (int i = 1; i <= n; i++) { if (i == t) continue; int cnt = 0; for (int j = 1; j <= m; j++) { if (a[i][j] != a[t][j]) cnt++; } if (cnt != k) { b = 0; break; } } if (b) { cout << t; return; } } } signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); if (fopen("in.txt", "r")) { freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); } // freopen("storagebox.inp", "r", stdin); // freopen("storagebox.out", "w", stdout); int tc = 1; // cin >> tc; while (tc--) solve(); }

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

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