제출 #871634

#제출 시각아이디문제언어결과실행 시간메모리
871634LittleFlowers__Genetics (BOI18_genetics)C++17
74 / 100
2049 ms25572 KiB
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include <bits/stdc++.h> using namespace std; string to_string(string s) { return '"' + s + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(bool b) { return (b ? "true" : "false"); } template <typename A, typename B> string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; } template <typename A> string to_string(A v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); } res += "}"; return res; } void debug_out() { cerr << endl; } template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); } #ifdef LOCAL #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__) mt19937 rng(101202); #else #define debug(...) 42 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); #endif #define in ({int x = 0; int c = getchar(), n = 0; for(; !isdigit(c); c = getchar()) n = (c == '-'); for(; isdigit(c); c = getchar()) x = x * 10 + c - '0'; n ? -x : x;}) int rnd(int l,int r) { if (l > r) { cerr << l << " " << r << "\n"; } return l + rng() % (r - l + 1); } const int N = 4210; int n, m, k; bitset<N * 4> mask[N]; int32_t main() { if (fopen("input.txt", "r")) { freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); } cin.tie(0)->sync_with_stdio(0); cin >> n >> m >> k; k = m - k; for (int i = 1; i <= n; ++i) { string s; cin >> s; for (int j = 0; j < m; ++j) { int p = s[j] == 'A' ? 0 : s[j] == 'C' ? 1 : s[j] == 'G' ? 2 : 3; mask[i][p * m + j].flip(); } } vector<int> p(n); iota(p.begin(), p.end(), 1); shuffle(p.begin(), p.end(), rng); for (const int &i : p) { bool valid = true; for (const int &j : p) { if (i == j) continue; int c = (mask[i] & mask[j]).count(); if (c != k) { valid = false; break; } } if (valid) return cout << i << '\n', 0; } }

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

genetics.cpp: In function 'int32_t main()':
genetics.cpp:70:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   70 |     freopen("input.txt", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...