Submission #1215584

#TimeUsernameProblemLanguageResultExecution timeMemory
1215584baliMutating DNA (IOI21_dna)C++20
Compilation error
0 ms0 KiB
#include "dna.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; string a; string b; void init(std::string aa, std::string bb) { a=aa; b=bb; } int get_distance(int x, int y) { ll c=0;ll c2=0; for(ll i=x; i<=y; i++) { if(a[i]!=b[i]) { c++; } if(a[i]-'T'==0) { c2++; } if(b[i]-'T'==0) { c2--; } } if(c2==0){return c/2;}else{return -1;} return 0; } #include "dna.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; string a; string b; void init(std::string aa, std::string bb) { a=aa; b=bb; } int get_distance(int x, int y) { ll c=0;ll c2=0; for(ll i=x; i<=y; i++) { if(a[i]!=b[i]) { c++; } if(a[i]-'T'==0) { c2++; } if(b[i]-'T'==0) { c2--; } } if(c2==0){return c/2;}else{return -1;} return 0; }

Compilation message (stderr)

dna.cpp:37:8: error: redefinition of 'std::string a'
   37 | string a;
      |        ^
dna.cpp:5:8: note: 'std::string a' previously declared here
    5 | string a;
      |        ^
dna.cpp:38:8: error: redefinition of 'std::string b'
   38 | string b;
      |        ^
dna.cpp:6:8: note: 'std::string b' previously declared here
    6 | string b;
      |        ^
dna.cpp:40:6: error: redefinition of 'void init(std::string, std::string)'
   40 | void init(std::string aa, std::string bb) {
      |      ^~~~
dna.cpp:8:6: note: 'void init(std::string, std::string)' previously defined here
    8 | void init(std::string aa, std::string bb) {
      |      ^~~~
dna.cpp:45:5: error: redefinition of 'int get_distance(int, int)'
   45 | int get_distance(int x, int y) {
      |     ^~~~~~~~~~~~
dna.cpp:13:5: note: 'int get_distance(int, int)' previously defined here
   13 | int get_distance(int x, int y) {
      |     ^~~~~~~~~~~~