제출 #602426

#제출 시각아이디문제언어결과실행 시간메모리
602426rrrr10000DNA 돌연변이 (IOI21_dna)C++17
100 / 100
48 ms8888 KiB
#include "dna.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vi; typedef vector<vi> vvi; typedef pair<ll,ll> P; typedef vector<P> vp; #define rep(i,n) for(ll i=0;i<(ll)(n);i++) #define REP(i,k,n) for(ll i=(ll)(k);i<(ll)(n);i++) vvi rui; void init(std::string a, std::string b) { ll n=a.size(); rui=vvi(6,vi(n+1)); rep(i,n)if(a[i]!=b[i]){ ll t; if(a[i]=='A'&&b[i]=='C')t=0; if(a[i]=='C'&&b[i]=='A')t=1; if(a[i]=='C'&&b[i]=='T')t=2; if(a[i]=='T'&&b[i]=='C')t=3; if(a[i]=='T'&&b[i]=='A')t=4; if(a[i]=='A'&&b[i]=='T')t=5; rui[t][i+1]++; } rep(i,6)rep(j,n)rui[i][j+1]+=rui[i][j]; } int get_distance(int x, int y) { y++; vi cnt(6); rep(i,6)cnt[i]=rui[i][y]-rui[i][x]; ll ans=0; rep(i,3){ ll t=min(cnt[i*2],cnt[i*2+1]); ans+=t; cnt[i*2]-=t; cnt[i*2+1]-=t; } if(cnt[0]+cnt[2]+cnt[4]==0&&cnt[1]==cnt[3]&&cnt[3]==cnt[5])ans+=cnt[1]*2; else if(cnt[1]+cnt[3]+cnt[5]==0&&cnt[0]==cnt[2]&&cnt[2]==cnt[4])ans+=cnt[0]*2; else return -1; return ans; }

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

dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:24:8: warning: 't' may be used uninitialized in this function [-Wmaybe-uninitialized]
   24 |   rui[t][i+1]++;
      |        ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...