Submission #1053234

#TimeUsernameProblemLanguageResultExecution timeMemory
1053234ZicrusMutating DNA (IOI21_dna)C++17
22 / 100
1592 ms3272 KiB
#include <bits/stdc++.h> #include "dna.h" using namespace std; typedef long long ll; string a, b; vector<ll> sum; void init(string a1, string b1) { a = a1; b = b1; sum = vector<ll>(a.size()+1); for (int i = 1; i <= a.size(); i++) { sum[i] = sum[i-1] + (a[i-1] != b[i-1]); } } int get_distance(int x, int y) { ll offA = 0; for (int i = x; i <= y; i++) { if (a[i] == 'A') offA++; if (b[i] == 'A') offA--; } if (offA != 0) return -1; ll cnt = sum[y+1] - sum[x]; return cnt / 2; }

Compilation message (stderr)

dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:13:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for (int i = 1; i <= a.size(); i++) {
      |                     ~~^~~~~~~~~~~
#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...