Submission #1108238

#TimeUsernameProblemLanguageResultExecution timeMemory
1108238NewtonabcMutating DNA (IOI21_dna)C++17
0 / 100
31 ms4720 KiB
#include "dna.h" #include<bits/stdc++.h> using namespace std; const int N=1e5+10; int prea[N],preb[N],pre[N]; void init(std::string a, std::string b) { int n=a.size(); prea[0]=(a[0]=='A'),preb[0]=(b[0]=='A'); for(int i=1;i<n;i++) prea[i]=prea[i-1]+(a[i]=='A'),preb[i]=preb[i-1]+(b[i]=='A'); pre[0]=(a[0]!=b[0]); for(int i=1;i<n;i++) pre[i]=pre[i-1]+(a[i]!=b[i]); /*for(int i=0;i<n;i++) cout<<pre[i] <<" "; cout<<'\n';*/ } int get_distance(int x, int y) { if(prea[y]-prea[x]==prea[y]-prea[x]) return (pre[y]-(x-1>=0?pre[x-1]:0))/2; return -1; }

Compilation message (stderr)

dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:17:20: warning: self-comparison always evaluates to true [-Wtautological-compare]
   17 |  if(prea[y]-prea[x]==prea[y]-prea[x]) return (pre[y]-(x-1>=0?pre[x-1]:0))/2;
      |     ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
#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...