Submission #467648

#TimeUsernameProblemLanguageResultExecution timeMemory
467648iggaboiMutating DNA (IOI21_dna)C++17
Compilation error
0 ms0 KiB
#ifdef Icry #include "debug.h" #else #include <bits/stdc++.h> #define debug(args...) #endif using namespace std; int main() { // ios_base::sync_with_stdio(0); // cin.tie(0); // ATC int n, q; cin >> n >> q; string a, b; cin >> a >> b; vector <int> noteq(n); vector <array <int, 3>> cnta(n, {0, 0, 0}), cntb(n, {0, 0, 0}); int mpa = 0, mpt = 1, mpc = 2; noteq[0] = a[0] != b[0]; cnta[0][mpa] = a[0] == 'A'; cnta[0][mpt] = a[0] == 'T'; cnta[0][mpc] = a[0] == 'C'; cntb[0][mpa] = b[0] == 'A'; cntb[0][mpt] = b[0] == 'T'; cntb[0][mpc] = b[0] == 'C'; for (int i = 1; i < n; ++i) { noteq[i] = noteq[i - 1] + (a[i] != b[i]); cnta[i][mpa] = cnta[i - 1][mpa]; cnta[i][mpt] = cnta[i - 1][mpt]; cnta[i][mpc] = cnta[i - 1][mpc]; cntb[i][mpa] = cntb[i - 1][mpa]; cntb[i][mpt] = cntb[i - 1][mpt]; cntb[i][mpc] = cntb[i - 1][mpc]; cnta[i][mpa] += a[i] == 'A'; cnta[i][mpt] += a[i] == 'T'; cnta[i][mpc] += a[i] == 'C'; cntb[i][mpa] += b[i] == 'A'; cntb[i][mpt] += b[i] == 'T'; cntb[i][mpc] += b[i] == 'C'; } auto query = [&](int i, int j, int mp, int t) { if (t == 1) return cnta[j][mp] - (i ? cnta[i - 1][mp] : 0); return cntb[j][mp] - (i ? cntb[i - 1][mp] : 0); }; while (q--) { int x, y; cin >> x >> y; int aa = query(x, y, 0, 1), at = query(x, y, 1, 1), ac = query(x, y, 2, 1); int ba = query(x, y, 0, 2), bt = query(x, y, 1, 2), bc = query(x, y, 2, 2); int neq = noteq[y] - (x ? noteq[x - 1] : 0); if (aa != ba || at != bt || ac != bc || neq % 2) cout << "-1\n"; else { cout << neq / 2 << '\n'; } } }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccfqZyYu.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccCTH2Lv.o:dna.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccfqZyYu.o: in function `main':
grader.cpp:(.text.startup+0x366): undefined reference to `init(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: grader.cpp:(.text.startup+0x39d): undefined reference to `get_distance(int, int)'
collect2: error: ld returned 1 exit status