#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
const int INF = 2147483645;
const int maxN = (int)1e3+5;
const ll LLINF = LLONG_MAX;
//const ll mod = 998244353;
const ll mod = 1000000007;
void solv() {
int n, q;
cin>>n>>q;
string a, b, ta;
cin>>a>>b;
int carry = 0;
int x;
char z;
for (int i=0;i<n;i++) a[i] -= 'a', b[i] -= 'a';
for (int i=0;i<=q;i++) {
if (i) {
cin>>x>>z;
carry = 0;
a[x-1] = z-'a';
}
ta = a;
for (int j=n-1;j>=0;j--) {
ta[j] = (ta[j] + carry)%26;
if (ta[j] > b[j]) carry = 26-ta[j]+b[j];
else carry = b[j]-ta[j];
}
if (ta[0] == b[0]) cout<<"da\n";
else cout<<"ne\n";
}
}
int main() {
ios::sync_with_stdio(0); cin.tie(0);
int t=1;
// cin>>t;
while (t--) solv();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
372 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
348 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
348 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
372 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
348 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
348 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
31 |
Correct |
15 ms |
3468 KB |
Output is correct |
32 |
Correct |
16 ms |
3316 KB |
Output is correct |
33 |
Correct |
15 ms |
3488 KB |
Output is correct |
34 |
Correct |
15 ms |
3484 KB |
Output is correct |
35 |
Correct |
16 ms |
3468 KB |
Output is correct |
36 |
Correct |
17 ms |
4080 KB |
Output is correct |
37 |
Correct |
16 ms |
3828 KB |
Output is correct |
38 |
Correct |
16 ms |
5264 KB |
Output is correct |
39 |
Correct |
16 ms |
5620 KB |
Output is correct |
40 |
Correct |
16 ms |
5604 KB |
Output is correct |
41 |
Correct |
16 ms |
5272 KB |
Output is correct |
42 |
Correct |
16 ms |
5372 KB |
Output is correct |
43 |
Correct |
15 ms |
5624 KB |
Output is correct |
44 |
Correct |
16 ms |
5280 KB |
Output is correct |
45 |
Correct |
16 ms |
5468 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
13 ms |
1004 KB |
Output is correct |
17 |
Correct |
13 ms |
1116 KB |
Output is correct |
18 |
Correct |
12 ms |
996 KB |
Output is correct |
19 |
Correct |
12 ms |
1116 KB |
Output is correct |
20 |
Correct |
11 ms |
1112 KB |
Output is correct |
21 |
Correct |
13 ms |
1116 KB |
Output is correct |
22 |
Correct |
12 ms |
1116 KB |
Output is correct |
23 |
Correct |
13 ms |
1116 KB |
Output is correct |
24 |
Correct |
13 ms |
1116 KB |
Output is correct |
25 |
Correct |
13 ms |
1112 KB |
Output is correct |
26 |
Correct |
12 ms |
1116 KB |
Output is correct |
27 |
Correct |
12 ms |
1116 KB |
Output is correct |
28 |
Correct |
12 ms |
1116 KB |
Output is correct |
29 |
Correct |
12 ms |
1120 KB |
Output is correct |
30 |
Correct |
13 ms |
1116 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
372 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
348 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
348 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
31 |
Correct |
13 ms |
1004 KB |
Output is correct |
32 |
Correct |
13 ms |
1116 KB |
Output is correct |
33 |
Correct |
12 ms |
996 KB |
Output is correct |
34 |
Correct |
12 ms |
1116 KB |
Output is correct |
35 |
Correct |
11 ms |
1112 KB |
Output is correct |
36 |
Correct |
13 ms |
1116 KB |
Output is correct |
37 |
Correct |
12 ms |
1116 KB |
Output is correct |
38 |
Correct |
13 ms |
1116 KB |
Output is correct |
39 |
Correct |
13 ms |
1116 KB |
Output is correct |
40 |
Correct |
13 ms |
1112 KB |
Output is correct |
41 |
Correct |
12 ms |
1116 KB |
Output is correct |
42 |
Correct |
12 ms |
1116 KB |
Output is correct |
43 |
Correct |
12 ms |
1116 KB |
Output is correct |
44 |
Correct |
12 ms |
1120 KB |
Output is correct |
45 |
Correct |
13 ms |
1116 KB |
Output is correct |
46 |
Correct |
811 ms |
1632 KB |
Output is correct |
47 |
Correct |
804 ms |
1636 KB |
Output is correct |
48 |
Correct |
785 ms |
1560 KB |
Output is correct |
49 |
Correct |
780 ms |
1356 KB |
Output is correct |
50 |
Correct |
801 ms |
1320 KB |
Output is correct |
51 |
Correct |
792 ms |
1104 KB |
Output is correct |
52 |
Correct |
809 ms |
1320 KB |
Output is correct |
53 |
Correct |
776 ms |
1504 KB |
Output is correct |
54 |
Correct |
798 ms |
1200 KB |
Output is correct |
55 |
Correct |
780 ms |
1140 KB |
Output is correct |
56 |
Correct |
781 ms |
1180 KB |
Output is correct |
57 |
Correct |
793 ms |
1192 KB |
Output is correct |
58 |
Correct |
793 ms |
1344 KB |
Output is correct |
59 |
Correct |
806 ms |
1112 KB |
Output is correct |
60 |
Correct |
794 ms |
1380 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
372 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
348 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
348 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
31 |
Correct |
15 ms |
3468 KB |
Output is correct |
32 |
Correct |
16 ms |
3316 KB |
Output is correct |
33 |
Correct |
15 ms |
3488 KB |
Output is correct |
34 |
Correct |
15 ms |
3484 KB |
Output is correct |
35 |
Correct |
16 ms |
3468 KB |
Output is correct |
36 |
Correct |
17 ms |
4080 KB |
Output is correct |
37 |
Correct |
16 ms |
3828 KB |
Output is correct |
38 |
Correct |
16 ms |
5264 KB |
Output is correct |
39 |
Correct |
16 ms |
5620 KB |
Output is correct |
40 |
Correct |
16 ms |
5604 KB |
Output is correct |
41 |
Correct |
16 ms |
5272 KB |
Output is correct |
42 |
Correct |
16 ms |
5372 KB |
Output is correct |
43 |
Correct |
15 ms |
5624 KB |
Output is correct |
44 |
Correct |
16 ms |
5280 KB |
Output is correct |
45 |
Correct |
16 ms |
5468 KB |
Output is correct |
46 |
Correct |
13 ms |
1004 KB |
Output is correct |
47 |
Correct |
13 ms |
1116 KB |
Output is correct |
48 |
Correct |
12 ms |
996 KB |
Output is correct |
49 |
Correct |
12 ms |
1116 KB |
Output is correct |
50 |
Correct |
11 ms |
1112 KB |
Output is correct |
51 |
Correct |
13 ms |
1116 KB |
Output is correct |
52 |
Correct |
12 ms |
1116 KB |
Output is correct |
53 |
Correct |
13 ms |
1116 KB |
Output is correct |
54 |
Correct |
13 ms |
1116 KB |
Output is correct |
55 |
Correct |
13 ms |
1112 KB |
Output is correct |
56 |
Correct |
12 ms |
1116 KB |
Output is correct |
57 |
Correct |
12 ms |
1116 KB |
Output is correct |
58 |
Correct |
12 ms |
1116 KB |
Output is correct |
59 |
Correct |
12 ms |
1120 KB |
Output is correct |
60 |
Correct |
13 ms |
1116 KB |
Output is correct |
61 |
Correct |
811 ms |
1632 KB |
Output is correct |
62 |
Correct |
804 ms |
1636 KB |
Output is correct |
63 |
Correct |
785 ms |
1560 KB |
Output is correct |
64 |
Correct |
780 ms |
1356 KB |
Output is correct |
65 |
Correct |
801 ms |
1320 KB |
Output is correct |
66 |
Correct |
792 ms |
1104 KB |
Output is correct |
67 |
Correct |
809 ms |
1320 KB |
Output is correct |
68 |
Correct |
776 ms |
1504 KB |
Output is correct |
69 |
Correct |
798 ms |
1200 KB |
Output is correct |
70 |
Correct |
780 ms |
1140 KB |
Output is correct |
71 |
Correct |
781 ms |
1180 KB |
Output is correct |
72 |
Correct |
793 ms |
1192 KB |
Output is correct |
73 |
Correct |
793 ms |
1344 KB |
Output is correct |
74 |
Correct |
806 ms |
1112 KB |
Output is correct |
75 |
Correct |
794 ms |
1380 KB |
Output is correct |
76 |
Execution timed out |
1020 ms |
5520 KB |
Time limit exceeded |
77 |
Halted |
0 ms |
0 KB |
- |