이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
using namespace std;
#pragma GCC optimize("Ofast")
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <map>
typedef long long LL;
typedef pair<int,int> pii;
#define F first
#define S second
#define pb push_back
#define mkp make_pair
#define iter(x) x.begin() x.end()
#define REP(n) for (int __=n;__--;)
#define REP0(i,n) for (int i=0;i<n;++i)
#define REP1(i,n) for (int i=1;i<=n;++i)
const int maxn = 1e5+10,mod = 0;
const LL inf = 0;
int pre[maxn][6];
void init(string a,string b){
const int n = a.size();
REP0(i,n){
if (a[i] == 'A'){
if (b[i] == 'C') ++pre[i+1][0];
else if (b[i] == 'T') ++pre[i+1][4];
}
else if (a[i] == 'C'){
if (b[i] == 'A') ++pre[i+1][3];
else if (b[i] == 'T') ++pre[i+1][2];
}
else{
if (b[i] == 'A') ++pre[i+1][1];
else if (b[i] == 'C') ++pre[i+1][5];
}
REP0(j,6) pre[i+1][j] += pre[i][j];
}
}
int get_distance(int x, int y){
int ans[6];
REP0(i,6) ans[i] = pre[y+1][i] - pre[x][i];
int cnt = 0;
REP0(i,3){
int m = min(ans[i],ans[i+3]);
cnt += m;
ans[i] -= m;
ans[i+3] -= m;
}
if (ans[0] == ans[1] and ans[1] == ans[2]) cnt += ans[0]*2;
else return -1;
if (ans[3] == ans[4] and ans[4] == ans[5]) cnt += ans[3]*2;
else return -1;
return cnt;
}
# | 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... |