Submission #955050

#TimeUsernameProblemLanguageResultExecution timeMemory
955050IUA_HasinMutating DNA (IOI21_dna)C++17
21 / 100
27 ms3260 KiB
#include <bits/stdc++.h> #define endl "\n" #define finp for(int i=0; i<n; i++) #define fknp for(int k=0; k<n; k++) #define yeap cout<<"YES"<<endl #define nope cout<<"NO"<<endl #define inpintn int n; cin>>n #define inpintarrn int arr[n]; for(int i=0; i<n; i++){cin>>arr[i];} #define inpllarrn long long arr[n]; for(int i=0; i<n; i++){cin>>arr[i];} #define ll long long using namespace std; #include "dna.h" ll const N = 1e5+10; string aa, bb; // ll arra[N], arrc[N], arrt[N]; // ll brra[N], brrc[N], brrt[N]; void init(std::string a, std::string b) { aa = a; bb = b; // ll siz = a.size(); // for(int i=1; i<=siz; i++){ // if(a[i-1]=='A'){ // arra[i] = arra[i-1]+1; // arrc[i] = arrc[i-1]; // } // } } int get_distance(int x, int y) { string s1 = aa.substr(x, y-x+1); string s2 = bb.substr(x, y-x+1); ll siz1 = s1.size(); ll siz2 = s2.size(); ll s1a = 0; ll s1c = 0; ll s1t = 0; ll s2a = 0; ll s2c = 0; ll s2t = 0; ll dif = 0; for(int i=0; i<siz1; i++){ if(s1[i]=='A'){ s1a++; } else if(s1[i]=='C'){ s1c++; } else { s1t++; } if(s2[i]=='A'){ s2a++; } else if(s2[i]=='C'){ s2c++; } else { s2t++; } if(s1[i]!=s2[i]){ dif++; } } ll ans; if(s1a==s2a && s1c==s2c && s1t==s2t){ if(dif==0){ return 0; } else if(dif==2){ return 1; } else { return 2; } } else { return -1; } }

Compilation message (stderr)

dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:38:5: warning: unused variable 'siz2' [-Wunused-variable]
   38 |  ll siz2 = s2.size();
      |     ^~~~
dna.cpp:66:5: warning: unused variable 'ans' [-Wunused-variable]
   66 |  ll ans;
      |     ^~~
#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...