Submission #1142574

#TimeUsernameProblemLanguageResultExecution timeMemory
1142574sam12345678910112Mutating DNA (IOI21_dna)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; # define ll long long string A ,B; int f[100003]; int fra[100003]; int frt[100003]; int fra2[100003]; int frt2[100003]; void init(string a, string b){ string A=a; string B=b; for(int so=0;so<A.size();so++){ f[so]=0; if(so!=0){f[so]+=f[so]; if(A[so]=='T'){frt[so]=0;frt[so]+=1+frt[so-1];} if(A[so]=='A'){fra[so]=0;fra[so]+=1+fra[so-1,];} if(B[so]=='T'){frt2[so]=0;frt2[so]+=1+frt2[so];} if(B[so]=='A'){fra2[so]=0;fra2[so]+=1+fra2[so-1,0];} } else { if(A[so]=='T'){frt[so]=0;frt[so]+=1;} if(A[so]=='A'){fra[so]=0;fra[so]+=1;} if(B[so]=='T'){frt2[so]=0;frt2[so]+=1;} if(B[so]=='A'){fra2[so]=0;fra2[so]+=1;} } if(A[so]!=B[so]){ f[so]+=1;} } } int get_distance(int x, int y){ if(frt[y]-frt[x]==frt2[y]-frt2[x]&&fra[y]-fra[x]==fra2[y]-fra2[x]){return f[y]-f[x];} else{ return -1;} }

Compilation message (stderr)

dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:17:55: warning: top-level comma expression in array subscript is deprecated [-Wcomma-subscript]
   17 |           if(A[so]=='A'){fra[so]=0;fra[so]+=1+fra[so-1,];}
      |                                                       ^
dna.cpp:17:56: error: expected primary-expression before ']' token
   17 |           if(A[so]=='A'){fra[so]=0;fra[so]+=1+fra[so-1,];}
      |                                                        ^
dna.cpp:19:58: warning: top-level comma expression in array subscript is deprecated [-Wcomma-subscript]
   19 |           if(B[so]=='A'){fra2[so]=0;fra2[so]+=1+fra2[so-1,0];}
      |                                                          ^