#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define S second
#define F first
#define all(x) (x).begin(),(x).end()
#define sz size()
#define Yes cout << "YES" << endl
#define No cout << "NO" << endl
#define pb(x) push_back(x);
#define endl '\n'
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int N=3e5+7;
ll INF=INT_MAX,mod=1e9+7;
int TT=1;
ll power(ll x, unsigned int y)
{
ll res = 1;
x = x; // % mod;
if (x == 0) return 0;
while (y > 0)
{
if (y & 1) res = (res*x) ; // % mod;
y = y>>1;
x = (x*x) ; // % mod;
}
return res;
}
string d[] = {"ne","da"};
void solve()
{
int n , q; cin >> n >> q;
string a, b; cin >> a >> b;
ll sum = 0;
bool bb = !(n&1);
for(int i = 0; i < n; i++)
{
if((i%2)^bb) sum+=int(b[i]-a[i]);
else sum-=int(b[i]-a[i]);
}
cout << d[(abs(sum)%26)==0] << endl;
while(q--)
{
ll x; char c;
cin >> x; cin >> c; x--;
bool aa = ((x%2)^bb);
if(aa) {sum-=int(b[x]-a[x]); a[x] = c; sum+=int(b[x]-a[x]);}
else {sum+=int(b[x]-a[x]); a[x] = c; sum-=int(b[x]-a[x]);}
cout << d[(abs(sum)%26)==0] << endl;
}
}
int main(){
//freopen("friday.in","r",stdin);
//freopen("friday.out","w",stdout);
fast;
while(TT--)
solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
360 KB |
Output is correct |
7 |
Correct |
0 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 |
512 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
360 KB |
Output is correct |
7 |
Correct |
0 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 |
512 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 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 |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 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 |
0 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 |
1 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
360 KB |
Output is correct |
7 |
Correct |
0 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 |
512 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 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 |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 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 |
0 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 |
1 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
31 |
Correct |
4 ms |
2808 KB |
Output is correct |
32 |
Correct |
4 ms |
2808 KB |
Output is correct |
33 |
Correct |
6 ms |
2808 KB |
Output is correct |
34 |
Correct |
4 ms |
2808 KB |
Output is correct |
35 |
Correct |
4 ms |
2808 KB |
Output is correct |
36 |
Correct |
4 ms |
2808 KB |
Output is correct |
37 |
Correct |
5 ms |
2804 KB |
Output is correct |
38 |
Correct |
4 ms |
2808 KB |
Output is correct |
39 |
Correct |
4 ms |
2808 KB |
Output is correct |
40 |
Correct |
4 ms |
2808 KB |
Output is correct |
41 |
Correct |
5 ms |
2808 KB |
Output is correct |
42 |
Correct |
5 ms |
2808 KB |
Output is correct |
43 |
Correct |
6 ms |
2936 KB |
Output is correct |
44 |
Correct |
4 ms |
2808 KB |
Output is correct |
45 |
Correct |
4 ms |
2808 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
360 KB |
Output is correct |
7 |
Correct |
0 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 |
512 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
11 ms |
604 KB |
Output is correct |
17 |
Correct |
11 ms |
604 KB |
Output is correct |
18 |
Correct |
11 ms |
600 KB |
Output is correct |
19 |
Correct |
12 ms |
856 KB |
Output is correct |
20 |
Correct |
11 ms |
604 KB |
Output is correct |
21 |
Correct |
11 ms |
600 KB |
Output is correct |
22 |
Correct |
11 ms |
600 KB |
Output is correct |
23 |
Correct |
11 ms |
716 KB |
Output is correct |
24 |
Correct |
11 ms |
712 KB |
Output is correct |
25 |
Correct |
11 ms |
600 KB |
Output is correct |
26 |
Correct |
11 ms |
600 KB |
Output is correct |
27 |
Correct |
11 ms |
600 KB |
Output is correct |
28 |
Correct |
11 ms |
604 KB |
Output is correct |
29 |
Correct |
11 ms |
604 KB |
Output is correct |
30 |
Correct |
11 ms |
600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
360 KB |
Output is correct |
7 |
Correct |
0 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 |
512 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 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 |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 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 |
0 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 |
1 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
31 |
Correct |
11 ms |
604 KB |
Output is correct |
32 |
Correct |
11 ms |
604 KB |
Output is correct |
33 |
Correct |
11 ms |
600 KB |
Output is correct |
34 |
Correct |
12 ms |
856 KB |
Output is correct |
35 |
Correct |
11 ms |
604 KB |
Output is correct |
36 |
Correct |
11 ms |
600 KB |
Output is correct |
37 |
Correct |
11 ms |
600 KB |
Output is correct |
38 |
Correct |
11 ms |
716 KB |
Output is correct |
39 |
Correct |
11 ms |
712 KB |
Output is correct |
40 |
Correct |
11 ms |
600 KB |
Output is correct |
41 |
Correct |
11 ms |
600 KB |
Output is correct |
42 |
Correct |
11 ms |
600 KB |
Output is correct |
43 |
Correct |
11 ms |
604 KB |
Output is correct |
44 |
Correct |
11 ms |
604 KB |
Output is correct |
45 |
Correct |
11 ms |
600 KB |
Output is correct |
46 |
Correct |
12 ms |
600 KB |
Output is correct |
47 |
Correct |
12 ms |
600 KB |
Output is correct |
48 |
Correct |
12 ms |
596 KB |
Output is correct |
49 |
Correct |
12 ms |
604 KB |
Output is correct |
50 |
Correct |
12 ms |
600 KB |
Output is correct |
51 |
Correct |
12 ms |
604 KB |
Output is correct |
52 |
Correct |
12 ms |
604 KB |
Output is correct |
53 |
Correct |
12 ms |
604 KB |
Output is correct |
54 |
Correct |
12 ms |
604 KB |
Output is correct |
55 |
Correct |
12 ms |
604 KB |
Output is correct |
56 |
Correct |
12 ms |
604 KB |
Output is correct |
57 |
Correct |
12 ms |
604 KB |
Output is correct |
58 |
Correct |
12 ms |
604 KB |
Output is correct |
59 |
Correct |
12 ms |
604 KB |
Output is correct |
60 |
Correct |
12 ms |
636 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
360 KB |
Output is correct |
7 |
Correct |
0 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 |
512 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 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 |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 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 |
0 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 |
1 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
31 |
Correct |
4 ms |
2808 KB |
Output is correct |
32 |
Correct |
4 ms |
2808 KB |
Output is correct |
33 |
Correct |
6 ms |
2808 KB |
Output is correct |
34 |
Correct |
4 ms |
2808 KB |
Output is correct |
35 |
Correct |
4 ms |
2808 KB |
Output is correct |
36 |
Correct |
4 ms |
2808 KB |
Output is correct |
37 |
Correct |
5 ms |
2804 KB |
Output is correct |
38 |
Correct |
4 ms |
2808 KB |
Output is correct |
39 |
Correct |
4 ms |
2808 KB |
Output is correct |
40 |
Correct |
4 ms |
2808 KB |
Output is correct |
41 |
Correct |
5 ms |
2808 KB |
Output is correct |
42 |
Correct |
5 ms |
2808 KB |
Output is correct |
43 |
Correct |
6 ms |
2936 KB |
Output is correct |
44 |
Correct |
4 ms |
2808 KB |
Output is correct |
45 |
Correct |
4 ms |
2808 KB |
Output is correct |
46 |
Correct |
11 ms |
604 KB |
Output is correct |
47 |
Correct |
11 ms |
604 KB |
Output is correct |
48 |
Correct |
11 ms |
600 KB |
Output is correct |
49 |
Correct |
12 ms |
856 KB |
Output is correct |
50 |
Correct |
11 ms |
604 KB |
Output is correct |
51 |
Correct |
11 ms |
600 KB |
Output is correct |
52 |
Correct |
11 ms |
600 KB |
Output is correct |
53 |
Correct |
11 ms |
716 KB |
Output is correct |
54 |
Correct |
11 ms |
712 KB |
Output is correct |
55 |
Correct |
11 ms |
600 KB |
Output is correct |
56 |
Correct |
11 ms |
600 KB |
Output is correct |
57 |
Correct |
11 ms |
600 KB |
Output is correct |
58 |
Correct |
11 ms |
604 KB |
Output is correct |
59 |
Correct |
11 ms |
604 KB |
Output is correct |
60 |
Correct |
11 ms |
600 KB |
Output is correct |
61 |
Correct |
12 ms |
600 KB |
Output is correct |
62 |
Correct |
12 ms |
600 KB |
Output is correct |
63 |
Correct |
12 ms |
596 KB |
Output is correct |
64 |
Correct |
12 ms |
604 KB |
Output is correct |
65 |
Correct |
12 ms |
600 KB |
Output is correct |
66 |
Correct |
12 ms |
604 KB |
Output is correct |
67 |
Correct |
12 ms |
604 KB |
Output is correct |
68 |
Correct |
12 ms |
604 KB |
Output is correct |
69 |
Correct |
12 ms |
604 KB |
Output is correct |
70 |
Correct |
12 ms |
604 KB |
Output is correct |
71 |
Correct |
12 ms |
604 KB |
Output is correct |
72 |
Correct |
12 ms |
604 KB |
Output is correct |
73 |
Correct |
12 ms |
604 KB |
Output is correct |
74 |
Correct |
12 ms |
604 KB |
Output is correct |
75 |
Correct |
12 ms |
636 KB |
Output is correct |
76 |
Correct |
135 ms |
14036 KB |
Output is correct |
77 |
Correct |
140 ms |
16400 KB |
Output is correct |
78 |
Correct |
143 ms |
16292 KB |
Output is correct |
79 |
Correct |
134 ms |
15992 KB |
Output is correct |
80 |
Correct |
148 ms |
16152 KB |
Output is correct |
81 |
Correct |
137 ms |
16004 KB |
Output is correct |
82 |
Correct |
137 ms |
16000 KB |
Output is correct |
83 |
Correct |
135 ms |
16120 KB |
Output is correct |
84 |
Correct |
136 ms |
16156 KB |
Output is correct |
85 |
Correct |
140 ms |
16576 KB |
Output is correct |
86 |
Correct |
139 ms |
16364 KB |
Output is correct |
87 |
Correct |
140 ms |
16344 KB |
Output is correct |
88 |
Correct |
134 ms |
16556 KB |
Output is correct |
89 |
Correct |
136 ms |
16000 KB |
Output is correct |
90 |
Correct |
144 ms |
16400 KB |
Output is correct |