제출 #716413

#제출 시각아이디문제언어결과실행 시간메모리
716413kidlinDNA 돌연변이 (IOI21_dna)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; const int val = 1e5+5; string s,t; int T0[val],C0[val],A0[val],T1[val],A1[val],C1[val], res[val]; void init(string a,string b){ s='#' + a,t= '#' + b; for(int i=1;i<s.size();i++) { if(s[i]=='T') T0[i]++; T0[i]+=T0[i-1]; if(s[i]=='C') C0[i]++; C0[i]+=C0[i-1]; if(s[i]=='A') A0[i]++; A0[i]+=A0[i-1]; if(t[i]=='T') T1[i]++; T1[i]+=T1[i-1]; if(t[i]=='C') C1[i]++; C1[i]+=C1[i-1]; if(t[i]=='A') A1[i]++; A1[i]+=A1[i-1]; if(t[i] != s[i]) res[i] ++; res[i] += res[i-1]; } } int get_distance(int x, int y) { x ++, y ++; int f = T0[y]-T0[x-1]; int f1 = T1[y]-T1[x-1]; int g = C0[y]-C0[x-1]; int g1 = C1[y]-C1[x-1]; int d = A0[y]-A0[x-1]; int d1 = A1[y]-A1[x-1]; if(f!=f1 || g!=g1 || d!=d1) return -1; return (res[y]-res[x-1]+1)/2; } signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t=1; //cin >> t; while(t--) { solve(); } }

컴파일 시 표준 에러 (stderr) 메시지

dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:8:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     for(int i=1;i<s.size();i++)
      |                 ~^~~~~~~~~
dna.cpp: In function 'int main()':
dna.cpp:53:9: error: 'solve' was not declared in this scope
   53 |         solve();
      |         ^~~~~