| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1312271 | opeleklanos | Mutating DNA (IOI21_dna) | C++20 | 17 ms | 4128 KiB |
#include <iostream>
#include <vector>
#include "dna.h"
using namespace std;
string a;
string b;
#define C first
#define A second.first
#define T second.second
vector<int> same;
vector<int> t1;
vector<int> t2;
void init(string a1, string b1){
a = a1;
b = b1;
int n = a.size();
same.assign(n+1, 0);
t1.assign(n+1, 0);
t2.assign(n+1, 0);
for(int i = 1; i<=n; i++){
same[i] = same[i-1] + (a[i-1] == b[i-1]);
t1[i] = t1[i-1] + (a[i-1] == 'T');
t2[i] = t2[i-1] + (b[i-1] == 'T');
}
}
int get_distance(int l, int r){
if(t1[r+1] - t1[l] != t2[r+1] - t2[l]) return -1;
return ((r-l+1) - same[r+1] - same[l]) /2;
}
int get_distancesubt1(int x, int y){
if(x == y){
if(a[x] == b[x]) return 0;
else return -1;
}
if(y - x == 1){
if(a[x] == b[x]){
if(a[y] == b[y]) return 0;
else return -1;
}
if(a[x] == b[y]){
if(a[y] == b[x]) return 1;
else return -1;
}
return -1;
}
if(y-x == 2){
pair<int, pair<int, int>> o;
for(int i = x; i<=y; i++){
if(a[i] == 'C') o.C++;
if(a[i] == 'A') o.A++;
if(a[i] == 'T') o.T++;
}
for(int i = x; i<=y; i++){
if(b[i] == 'C') o.C--;
if(b[i] == 'A') o.A--;
if(b[i] == 'T') o.T--;
}
if(o.C != 0 || o.A != 0 || o.T != 0) return -1;
int same = 0;
for(int i = x; i<=y; i++) same += (a[i] == b[i]);
if(same == 1) return 1;
if(same == 0) return 2;
if(same == 3) return 0;
return -1;
}
}
컴파일 시 표준 에러 (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... | ||||
