제출 #1093506

#제출 시각아이디문제언어결과실행 시간메모리
1093506vjudge1Genetics (BOI18_genetics)C++17
27 / 100
2019 ms3152 KiB
// #pragma GCC optimize("O3","unroll-loops") #include <bits/stdc++.h> using namespace std; // #define #define int long long #define all(v) v.begin(), v.end() #define fi first #define se second #define file "file" #define bit(x, y) ((y >> x) & 1) #define __lcm(a, b) a * b / __gcd(a, b) #define R(x) {cout << x << "\n"; return;} #define coutf(x) cout << fixed << setprecision(x) #define inter(a) cout << a << "\n"; fflush(stdout) mt19937_64 rnd(chrono::high_resolution_clock::now().time_since_epoch().count()); // declare const int N = 4100; int n, m, k, d[N + 5][4]; map <char, int> mp; string s[N + 5]; int rand(int l, int r) { int d = r - l + 1; return rnd() % d + l; } int K(int i, int j) { int ans = 0; for (int k = 1; k <= m; ++k) if (s[i][k - 1] != s[j][k - 1]) ++ans; return ans; } bool Check(int x) { for (int i = 1; i <= n; ++i) { int d = i; if (d == x) continue; if (K(x, d) != k) return false; } return true; } void Solve() { mp['A'] = 0; mp['T'] = 1; mp['G'] = 2; mp['C'] = 3; cin >> n >> m >> k; for (int i = 1; i <= n; ++i) { cin >> s[i]; for (int j = 1; j <= m; ++j) ++d[j][mp[s[i][j - 1]]]; } for (int i = 1; i <= n; ++i) { int now = 0; for (int j = 1; j <= m; ++j) now += n - d[j][mp[s[i][j - 1]]]; if (now == (n - 1) * k) if (Check(i)) R(i); } } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); if (fopen(file ".inp", "r")) { freopen (file ".inp", "r", stdin); freopen (file ".out", "w", stdout); } int t = 1; // cin >> t; while (t--) Solve(); cerr << "\nTIME: " << 1000 * clock() / CLOCKS_PER_SEC << "ms."; }

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

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