이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bits/stdc++.h"
using namespace std;
#ifdef Nero
#include "Deb.h"
#else
#define debug(...)
#endif
void move(char& c, int ops) {
int toz = 'z' - c;
if (ops <= toz) {
c += ops;
} else {
ops -= toz + 1;
c = 'a' + ops;
}
}
void check(string s, string t) {
int n = (int) s.size();
for (int i = 0; i < n - 1; ++i) {
int diff = t[i] - s[i];
if (diff < 0) {
diff += 26;
}
if (diff > 0) {
move(s[i], diff);
move(s[i + 1], diff);
}
}
cout << (s[n - 1] == t[n - 1] ? "da" : "ne") << '\n';
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, q;
cin >> n >> q;
string s, t;
cin >> s >> t;
check(s, t);
while (q--) {
int p;
char c;
cin >> p >> c;
s[p - 1] = c;
check(s, t);
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |