제출 #1001958

#제출 시각아이디문제언어결과실행 시간메모리
1001958hacizadalDNA 돌연변이 (IOI21_dna)C++17
43 / 100
1549 ms4724 KiB
#include "dna.h" #include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long #define pll pair<ll, ll> string s, t; ll p[100005]; void init(std::string a, std::string b) { s = a; t = b; for (ll i = 0; i<s.length(); i++){ p[i+1] = p[i]; if (s[i] != t[i]) p[i+1]++; } } int get_distance(int x, int y) { string k = s.substr(x, y-x+1); string g = t.substr(x, y-x+1); string a = k; string b = g; sort(a.begin(), a.end()); sort(b.begin(), b.end()); if (a != b){ return -1; } if (k == g){ return 0; } if (y - x <= 2){ if (k[1] == g[1] or k[0] == g[0] or k[2] == g[2]){ return 1; } else { return 2; } } ll cnt = p[y+1] - p[x]; cnt /= 2; return cnt; }

컴파일 시 표준 에러 (stderr) 메시지

dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:14:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for (ll i = 0; i<s.length(); 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...