Submission #1097676

#TimeUsernameProblemLanguageResultExecution timeMemory
1097676WarinchaiMutating DNA (IOI21_dna)C++17
0 / 100
21 ms5916 KiB
#include "dna.h" #include<bits/stdc++.h> using namespace std; long long vala[100005]; long long valb[100005]; long long same[100005]; int difA[100005]; int difC[100005]; int difT[100005]; long long md=1e9+7; void init(std::string a, std::string b) { long long ta=0,tb=0; for(int i=0;i<a.size();i++){ vala[i+1]=((vala[i]*26)%md+a[i]-'A')%md; valb[i+1]=((valb[i]*26)%md+b[i]-'A')%md; same[i+1]=same[i]; if(a[i+1]==b[i+1])same[i+1]++; } } int get_distance(int x, int y) { x++,y++; long long ta=(vala[y]+md-vala[x-1])%md; long long tb=(valb[y]+md-valb[x-1])%md; if(ta!=tb)return -1; int val=y-x+1-same[y]-same[x-1]; return val/2; }

Compilation message (stderr)

dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:13:18: 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=0;i<a.size();i++){
      |                 ~^~~~~~~~~
dna.cpp:12:15: warning: unused variable 'ta' [-Wunused-variable]
   12 |     long long ta=0,tb=0;
      |               ^~
dna.cpp:12:20: warning: unused variable 'tb' [-Wunused-variable]
   12 |     long long ta=0,tb=0;
      |                    ^~
#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...