Submission #757956

#TimeUsernameProblemLanguageResultExecution timeMemory
757956LeSonnnGenetics (BOI18_genetics)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define task "TXKCK" using namespace std; typedef long long int64_t; const int64_t oo = (1ll << 61) - 1; int n, m, k; void add(int64_t &a, int64_t b) { a += b; if (a >= oo) { a -= oo; } } void progress() { //cout << oo << " "; cin >> n >> m >> k; vector<std::string> S(n); for (auto &e : S) { cin >> e; } vector<int64_t> H(n); mt19937 mt(100); uniform_int_distribution<int64_t> dist(0, oo - 1); for (auto &e : H) { e = dist(mt); } vector<std::array<int64_t, 4>> hl(m, {0, 0, 0, 0}); auto get_id = [&](char x) { if (x == 'A') return 0; if (x == 'C') return 1; if (x == 'G') return 2; return 3; }; for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { add(hl[j][get_id(S[i][j])], H[i]); } } for (int i = 0; i < n; ++i) { int64_t sum(0); for (int j = 0; j < m; ++j) { const int v = get_id(S[i][j]); for (int x = 0; x < 4; ++x) { if (x == v) { continue; } add(sum, hl[j][x]); } } int64_t expr(0); for (int j = 0; j < n; ++j) { if (i == j) { continue; } add(expr, H[j]); } expr = (int64_t)(__int128_t(expr) * __int128_t(k) % __int128_t(oo)); if (expr == sum) { cout << i + 1 << '\n'; break; } } } // main int main() { // Written by Shyn_ ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL); if (fopen(task ".inp", "r")) { freopen(task ".inp", "r", stdin); freopen(task ".out", "w", stdout); } int64_t nt = 1; // cin >> nt; for (; nt--;) { progress(); } } /** LeSonnn_ **/ /** LCG **/

Compilation message (stderr)

genetics.cpp:4:19: error: conflicting declaration 'typedef long long int int64_t'
    4 | typedef long long int64_t;
      |                   ^~~~~~~
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:155,
                 from /usr/include/stdlib.h:394,
                 from /usr/include/c++/10/bits/std_abs.h:38,
                 from /usr/include/c++/10/cmath:47,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from genetics.cpp:1:
/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:27:19: note: previous declaration as 'typedef __int64_t int64_t'
   27 | typedef __int64_t int64_t;
      |                   ^~~~~~~
genetics.cpp: In function 'int main()':
genetics.cpp:100:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  100 |         freopen(task ".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
genetics.cpp:101:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  101 |         freopen(task ".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~