Submission #529182

#TimeUsernameProblemLanguageResultExecution timeMemory
529182Icebear16Mutating DNA (IOI21_dna)C++17
Compilation error
0 ms0 KiB
#include "dna.h" int n,q; void init(std::string a, std::string b) { } int get_distance(int x, int y) { int h1,h2,l1,l2,k1,k2; for(int i=x;i<=y;i++){ if(a[i]=='A'){ h1++; }else if(a[i]=='T'){ l1++; }else if(a[i]=='C'){ k1++; } if(b[i]=='A'){ h2++; }else if(b[i]=='T'){ l2++; }else if(b[i]=='C'){ k2++; } } if(h1==h2 && l1==l2 && k1==k2){ int j=0; for(int i=x;i<=y;i++){ if(a[i]!=b[i]){ j+=1; } } if(j%2==1){ j+=1; } return j/2; }else{ return -1; } }

Compilation message (stderr)

dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:9:6: error: 'a' was not declared in this scope
    9 |   if(a[i]=='A'){
      |      ^
dna.cpp:16:6: error: 'b' was not declared in this scope
   16 |   if(b[i]=='A'){
      |      ^
dna.cpp:27:7: error: 'a' was not declared in this scope
   27 |    if(a[i]!=b[i]){
      |       ^
dna.cpp:27:13: error: 'b' was not declared in this scope
   27 |    if(a[i]!=b[i]){
      |             ^