답안 #948142

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
948142 2024-03-17T16:24:45 Z Abito Bliskost (COI23_bliskost) C++17
100 / 100
226 ms 23924 KB
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ppb pop_back
#define ep insert
#define endl '\n'
#define elif else if
#define pow pwr
#define sqrt sqrtt
#define int long long
#define ll long long
typedef unsigned long long ull;
using namespace std;
const int N=1e6+5;
int n,q,a[N];
char s[N],z[N];
int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    cin>>n>>q;
    for (int i=1;i<=n;i++) cin>>s[i];
    for (int i=1;i<=n;i++) cin>>z[i];
    for (int i=1;i<=n;i++) a[i]=((z[i]-'a')-(s[i]-'a')+26)%26;
    int p=0;
    for (int i=1;i<n;i++) p=26-a[i]-p;
    p+=26*1e10;
    p%=26;
    for (int Q=0;Q<=q;Q++){
        if (Q){
            int i;char c;
            cin>>i>>c;
            s[i]=c;
            int x=a[i];
            a[i]=((z[i]-'a')-(s[i]-'a')+26)%26;
            int d=(a[i]-x+26)%26;
            if (i<n){
                if ((n-i)&1) p=(p-d+26)%26;
                else p=(p+d)%26;
            }
        }
        //cout<<p<<endl;
        if ((p+a[n])%26) cout<<"ne"<<endl;
        else cout<<"da"<<endl;
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2516 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2512 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 3 ms 2396 KB Output is correct
13 Correct 2 ms 2396 KB Output is correct
14 Correct 1 ms 2392 KB Output is correct
15 Correct 2 ms 2392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2516 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2512 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 3 ms 2396 KB Output is correct
13 Correct 2 ms 2396 KB Output is correct
14 Correct 1 ms 2392 KB Output is correct
15 Correct 2 ms 2392 KB Output is correct
16 Correct 2 ms 2396 KB Output is correct
17 Correct 1 ms 2392 KB Output is correct
18 Correct 2 ms 2396 KB Output is correct
19 Correct 1 ms 2392 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2392 KB Output is correct
24 Correct 1 ms 2392 KB Output is correct
25 Correct 2 ms 2396 KB Output is correct
26 Correct 1 ms 2516 KB Output is correct
27 Correct 1 ms 2648 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2516 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2512 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 3 ms 2396 KB Output is correct
13 Correct 2 ms 2396 KB Output is correct
14 Correct 1 ms 2392 KB Output is correct
15 Correct 2 ms 2392 KB Output is correct
16 Correct 2 ms 2396 KB Output is correct
17 Correct 1 ms 2392 KB Output is correct
18 Correct 2 ms 2396 KB Output is correct
19 Correct 1 ms 2392 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2392 KB Output is correct
24 Correct 1 ms 2392 KB Output is correct
25 Correct 2 ms 2396 KB Output is correct
26 Correct 1 ms 2516 KB Output is correct
27 Correct 1 ms 2648 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 24 ms 11456 KB Output is correct
32 Correct 21 ms 11344 KB Output is correct
33 Correct 21 ms 11348 KB Output is correct
34 Correct 22 ms 11512 KB Output is correct
35 Correct 22 ms 11348 KB Output is correct
36 Correct 23 ms 11356 KB Output is correct
37 Correct 26 ms 11292 KB Output is correct
38 Correct 24 ms 11276 KB Output is correct
39 Correct 22 ms 11380 KB Output is correct
40 Correct 21 ms 11348 KB Output is correct
41 Correct 21 ms 11348 KB Output is correct
42 Correct 22 ms 11344 KB Output is correct
43 Correct 21 ms 11352 KB Output is correct
44 Correct 21 ms 11348 KB Output is correct
45 Correct 23 ms 11600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2516 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2512 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 3 ms 2396 KB Output is correct
13 Correct 2 ms 2396 KB Output is correct
14 Correct 1 ms 2392 KB Output is correct
15 Correct 2 ms 2392 KB Output is correct
16 Correct 11 ms 3160 KB Output is correct
17 Correct 11 ms 3140 KB Output is correct
18 Correct 12 ms 3160 KB Output is correct
19 Correct 12 ms 3160 KB Output is correct
20 Correct 11 ms 3164 KB Output is correct
21 Correct 14 ms 3164 KB Output is correct
22 Correct 15 ms 3164 KB Output is correct
23 Correct 14 ms 3156 KB Output is correct
24 Correct 12 ms 3164 KB Output is correct
25 Correct 12 ms 3160 KB Output is correct
26 Correct 14 ms 3160 KB Output is correct
27 Correct 11 ms 3164 KB Output is correct
28 Correct 12 ms 3040 KB Output is correct
29 Correct 12 ms 3164 KB Output is correct
30 Correct 11 ms 3164 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2516 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2512 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 3 ms 2396 KB Output is correct
13 Correct 2 ms 2396 KB Output is correct
14 Correct 1 ms 2392 KB Output is correct
15 Correct 2 ms 2392 KB Output is correct
16 Correct 2 ms 2396 KB Output is correct
17 Correct 1 ms 2392 KB Output is correct
18 Correct 2 ms 2396 KB Output is correct
19 Correct 1 ms 2392 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2392 KB Output is correct
24 Correct 1 ms 2392 KB Output is correct
25 Correct 2 ms 2396 KB Output is correct
26 Correct 1 ms 2516 KB Output is correct
27 Correct 1 ms 2648 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 11 ms 3160 KB Output is correct
32 Correct 11 ms 3140 KB Output is correct
33 Correct 12 ms 3160 KB Output is correct
34 Correct 12 ms 3160 KB Output is correct
35 Correct 11 ms 3164 KB Output is correct
36 Correct 14 ms 3164 KB Output is correct
37 Correct 15 ms 3164 KB Output is correct
38 Correct 14 ms 3156 KB Output is correct
39 Correct 12 ms 3164 KB Output is correct
40 Correct 12 ms 3160 KB Output is correct
41 Correct 14 ms 3160 KB Output is correct
42 Correct 11 ms 3164 KB Output is correct
43 Correct 12 ms 3040 KB Output is correct
44 Correct 12 ms 3164 KB Output is correct
45 Correct 11 ms 3164 KB Output is correct
46 Correct 12 ms 3164 KB Output is correct
47 Correct 14 ms 3236 KB Output is correct
48 Correct 12 ms 3296 KB Output is correct
49 Correct 13 ms 3164 KB Output is correct
50 Correct 15 ms 3164 KB Output is correct
51 Correct 14 ms 3164 KB Output is correct
52 Correct 12 ms 3164 KB Output is correct
53 Correct 12 ms 3164 KB Output is correct
54 Correct 14 ms 3148 KB Output is correct
55 Correct 12 ms 3160 KB Output is correct
56 Correct 12 ms 3156 KB Output is correct
57 Correct 14 ms 3164 KB Output is correct
58 Correct 13 ms 3220 KB Output is correct
59 Correct 13 ms 3160 KB Output is correct
60 Correct 13 ms 3160 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2516 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2512 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 3 ms 2396 KB Output is correct
13 Correct 2 ms 2396 KB Output is correct
14 Correct 1 ms 2392 KB Output is correct
15 Correct 2 ms 2392 KB Output is correct
16 Correct 2 ms 2396 KB Output is correct
17 Correct 1 ms 2392 KB Output is correct
18 Correct 2 ms 2396 KB Output is correct
19 Correct 1 ms 2392 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2392 KB Output is correct
24 Correct 1 ms 2392 KB Output is correct
25 Correct 2 ms 2396 KB Output is correct
26 Correct 1 ms 2516 KB Output is correct
27 Correct 1 ms 2648 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 24 ms 11456 KB Output is correct
32 Correct 21 ms 11344 KB Output is correct
33 Correct 21 ms 11348 KB Output is correct
34 Correct 22 ms 11512 KB Output is correct
35 Correct 22 ms 11348 KB Output is correct
36 Correct 23 ms 11356 KB Output is correct
37 Correct 26 ms 11292 KB Output is correct
38 Correct 24 ms 11276 KB Output is correct
39 Correct 22 ms 11380 KB Output is correct
40 Correct 21 ms 11348 KB Output is correct
41 Correct 21 ms 11348 KB Output is correct
42 Correct 22 ms 11344 KB Output is correct
43 Correct 21 ms 11352 KB Output is correct
44 Correct 21 ms 11348 KB Output is correct
45 Correct 23 ms 11600 KB Output is correct
46 Correct 11 ms 3160 KB Output is correct
47 Correct 11 ms 3140 KB Output is correct
48 Correct 12 ms 3160 KB Output is correct
49 Correct 12 ms 3160 KB Output is correct
50 Correct 11 ms 3164 KB Output is correct
51 Correct 14 ms 3164 KB Output is correct
52 Correct 15 ms 3164 KB Output is correct
53 Correct 14 ms 3156 KB Output is correct
54 Correct 12 ms 3164 KB Output is correct
55 Correct 12 ms 3160 KB Output is correct
56 Correct 14 ms 3160 KB Output is correct
57 Correct 11 ms 3164 KB Output is correct
58 Correct 12 ms 3040 KB Output is correct
59 Correct 12 ms 3164 KB Output is correct
60 Correct 11 ms 3164 KB Output is correct
61 Correct 12 ms 3164 KB Output is correct
62 Correct 14 ms 3236 KB Output is correct
63 Correct 12 ms 3296 KB Output is correct
64 Correct 13 ms 3164 KB Output is correct
65 Correct 15 ms 3164 KB Output is correct
66 Correct 14 ms 3164 KB Output is correct
67 Correct 12 ms 3164 KB Output is correct
68 Correct 12 ms 3164 KB Output is correct
69 Correct 14 ms 3148 KB Output is correct
70 Correct 12 ms 3160 KB Output is correct
71 Correct 12 ms 3156 KB Output is correct
72 Correct 14 ms 3164 KB Output is correct
73 Correct 13 ms 3220 KB Output is correct
74 Correct 13 ms 3160 KB Output is correct
75 Correct 13 ms 3160 KB Output is correct
76 Correct 168 ms 22868 KB Output is correct
77 Correct 168 ms 23868 KB Output is correct
78 Correct 219 ms 23636 KB Output is correct
79 Correct 164 ms 23748 KB Output is correct
80 Correct 212 ms 23632 KB Output is correct
81 Correct 190 ms 23664 KB Output is correct
82 Correct 168 ms 23840 KB Output is correct
83 Correct 164 ms 23632 KB Output is correct
84 Correct 175 ms 23924 KB Output is correct
85 Correct 192 ms 23640 KB Output is correct
86 Correct 162 ms 23864 KB Output is correct
87 Correct 220 ms 23824 KB Output is correct
88 Correct 168 ms 23632 KB Output is correct
89 Correct 226 ms 23772 KB Output is correct
90 Correct 188 ms 23636 KB Output is correct