# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
957143 | 2024-04-03T05:07:27 Z | DeltaStruct | DNA 돌연변이 (IOI21_dna) | C++17 | 39 ms | 9572 KB |
#include "dna.h" #include <bits/stdc++.h> using namespace std; string x,y,u="ACT"; int n; map<string,vector<int>> acc; void init(string a,string b){ x = a,y = b,n = a.size(); for (auto c:u) for (auto d:u) if (c!=d){ string i = to_string(c)+to_string(d); acc[i] = {0}; for (int k(0);k < n;++k) acc[i].emplace_back(acc[i].back()+(x[k]==c&&y[k]==d)); } } int get_distance(int l,int r){ ++r; auto sb = [&acc,&l,&r](string s,string t){ return (acc[s][r]-acc[s][l])-(acc[t][r]-acc[t][l]); }; if (sb("AC","CA")!=sb("CT","TC")||sb("AC","CA")!=sb("TA","AT")) return -1; int res = abs(sb("AC","CA"))*2; for (int i(0);i < 3;++i) for (int k(0);k < 3;++k){ string s = to_string(u[i])+to_string(u[k]),t = to_string(u[k])+to_string(u[i]); res += min(acc[s][r]-acc[s][l],acc[t][r]-acc[t][l]); } return res; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 39 ms | 9572 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 348 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 348 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 348 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 39 ms | 9572 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |