이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//#include "dna_ioi.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,b) for(int i=a;i<b;i++)
string A,B;
void init(std::string a, std::string b) {
a=A;b=B;
}
int get_distance(int x, int y) {
string b=B;string a=A;
int n=A.size();
if(x==y){
if(a[x]==b[x])return 0;
else return -1;
}
if(y-x==1){
if(a[x]+a[y]==b[x]+b[y])return 0;
else if(a[y]+a[x]==b[x]+b[y])return 1;
else return -1;
}
if(y-x==2){
int aa,at,ac,ba,bt,bc;
rep(i,0,n){
if(a[i]=='A')aa++;
if(a[i]=='T')at++;
if(a[i]=='C')ac++;
if(b[i]=='A')ba++;
if(b[i]=='T')bt++;
if(b[i]=='C')bc++;
}
if(aa!=ba or at!=bt or ac!=bc)return -1;
if(a[x]+a[x+1]+a[x+2]==b[x]+b[x+1]+b[x+2])return 0;
if(a[x]==b[x] or a[x+1]==b[x+1]or a[x+2]==b[x+2])return 1;
else return 2;
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:34:29: warning: 'bc' may be used uninitialized in this function [-Wmaybe-uninitialized]
34 | if(aa!=ba or at!=bt or ac!=bc)return -1;
| ~~~~~~~~~~~~~~~~~^~~~~~~~~
dna.cpp:34:24: warning: 'bt' may be used uninitialized in this function [-Wmaybe-uninitialized]
34 | if(aa!=ba or at!=bt or ac!=bc)return -1;
| ~~^~~~
dna.cpp:34:14: warning: 'ba' may be used uninitialized in this function [-Wmaybe-uninitialized]
34 | if(aa!=ba or at!=bt or ac!=bc)return -1;
| ~~^~~~
dna.cpp:34:29: warning: 'ac' may be used uninitialized in this function [-Wmaybe-uninitialized]
34 | if(aa!=ba or at!=bt or ac!=bc)return -1;
| ~~~~~~~~~~~~~~~~~^~~~~~~~~
dna.cpp:34:24: warning: 'at' may be used uninitialized in this function [-Wmaybe-uninitialized]
34 | if(aa!=ba or at!=bt or ac!=bc)return -1;
| ~~^~~~
dna.cpp:34:14: warning: 'aa' may be used uninitialized in this function [-Wmaybe-uninitialized]
34 | if(aa!=ba or at!=bt or ac!=bc)return -1;
| ~~^~~~
# | 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... |