# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
639753 | ghostwriter | DNA 돌연변이 (IOI21_dna) | C++17 | 49 ms | 7420 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "dna.h"
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include <debug.h>
#include "grader.cpp"
#endif
#define st first
#define nd second
#define pb push_back
#define pf push_front
#define _pb pop_back
#define _pf pop_front
#define lb lower_bound
#define ub upper_bound
#define mtp make_tuple
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
typedef long long ll; typedef unsigned long long ull;
typedef double db; typedef long double ldb;
typedef pair<int, int> pi; typedef pair<ll, ll> pll;
typedef vector<int> vi; typedef vector<ll> vll; typedef vector<pi> vpi; typedef vector<pll> vpll;
typedef string str;
template<typename T> T gcd(T a, T b) { return (b == 0? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define FOR(i, l, r) for (int (i) = (l); (i) <= (r); ++(i))
#define FOS(i, r, l) for (int (i) = (r); (i) >= (l); --(i))
#define EACH(i, x) for (auto &(i) : (x))
#define WHILE while
#define file "TEST"
mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());
ll rand(ll l, ll r) { return uniform_int_distribution<ll>(l, r)(rd); }
/*
Tran The Bao
CTL - Da Lat
Cay ngay cay dem nhung deo duoc cong nhan
*/
const int N = 1e5 + 5;
#define getid(x) (x == 'A'? 0 : x == 'T'? 1 : 2)
int n, d[N][3][3], cnt[3][3];
void init(std::string a, std::string b) {
n = sz(a);
FOR(i, 0, n - 1) {
FOR(j, 0, 2)
FOR(z, 0, 2)
d[i][j][z] = (i == 0? 0 : d[i - 1][j][z]);
++d[i][getid(a[i])][getid(b[i])];
}
}
int get_distance(int x, int y) {
FOR(i, 0, 2)
FOR(j, 0, 2)
cnt[i][j] = d[y][i][j] - (x == 0? 0 : d[x - 1][i][j]);
if (cnt[0][1] + cnt[0][2] != cnt[1][0] + cnt[2][0]) return -1;
if (cnt[1][0] + cnt[1][2] != cnt[0][1] + cnt[2][1]) return -1;
if (cnt[2][0] + cnt[2][1] != cnt[0][2] + cnt[1][2]) return -1;
int total = cnt[0][1] + cnt[0][2] + cnt[1][0] + cnt[1][2] + cnt[2][0] + cnt[2][1];
int cnt2 = 0;
cnt2 += min(cnt[0][1], cnt[1][0]);
cnt2 += min(cnt[0][2], cnt[2][0]);
cnt2 += min(cnt[1][2], cnt[2][1]);
return total - cnt2 - (total - cnt2 * 2) / 3;
}
/*
6 3
ATACAT
ACTATA
1 3
4 5
3 5
*/
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |