답안 #1108451

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1108451 2024-11-04T07:31:11 Z nasir_bashirov Bliskost (COI23_bliskost) C++11
100 / 100
139 ms 16532 KB
// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
 
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define db long double
#define vll vector<pll>
#define endl '\n'
#define all(x) x.begin(), x.end()
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
// #define int long long

void fmain(){
    fastio;
    int n, q;
    string s, t;
    cin >> n >> q >> s >> t;
    int sum = 0;
    for(int i = 0; i < n; i++){
        sum = (-sum + t[i] - s[i] + 26) % 26;
    }
    cout << (!sum ? "da" : "ne") << endl;
    while(q--){
        int idx;
        char c;
        cin >> idx >> c;
        int diff = c - s[idx - 1];
        s[idx - 1] = c;
        sum = (sum + 26 + diff + ((n - idx + 1) & 1) * -2 * diff) % 26;
        cout << (!sum ? "da" : "ne") << endl;
    }
}
 
signed main(){
    int tmr = 1;
    // cin >> tmr;
    while(tmr--){
        fmain();
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 500 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 504 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 0 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 0 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 500 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 504 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 0 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 0 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 504 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 0 ms 336 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 508 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 500 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 504 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 0 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 0 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 504 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 0 ms 336 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 508 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
31 Correct 11 ms 2796 KB Output is correct
32 Correct 10 ms 2796 KB Output is correct
33 Correct 11 ms 2796 KB Output is correct
34 Correct 10 ms 2816 KB Output is correct
35 Correct 9 ms 2776 KB Output is correct
36 Correct 9 ms 2796 KB Output is correct
37 Correct 9 ms 2796 KB Output is correct
38 Correct 8 ms 2796 KB Output is correct
39 Correct 9 ms 2796 KB Output is correct
40 Correct 9 ms 2796 KB Output is correct
41 Correct 9 ms 2796 KB Output is correct
42 Correct 10 ms 2796 KB Output is correct
43 Correct 10 ms 2796 KB Output is correct
44 Correct 9 ms 2968 KB Output is correct
45 Correct 10 ms 2796 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 500 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 504 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 0 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 0 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 8 ms 592 KB Output is correct
17 Correct 9 ms 592 KB Output is correct
18 Correct 9 ms 760 KB Output is correct
19 Correct 8 ms 592 KB Output is correct
20 Correct 8 ms 764 KB Output is correct
21 Correct 10 ms 604 KB Output is correct
22 Correct 9 ms 592 KB Output is correct
23 Correct 11 ms 568 KB Output is correct
24 Correct 9 ms 592 KB Output is correct
25 Correct 9 ms 592 KB Output is correct
26 Correct 8 ms 592 KB Output is correct
27 Correct 8 ms 592 KB Output is correct
28 Correct 9 ms 592 KB Output is correct
29 Correct 8 ms 592 KB Output is correct
30 Correct 8 ms 572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 500 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 504 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 0 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 0 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 504 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 0 ms 336 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 508 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
31 Correct 8 ms 592 KB Output is correct
32 Correct 9 ms 592 KB Output is correct
33 Correct 9 ms 760 KB Output is correct
34 Correct 8 ms 592 KB Output is correct
35 Correct 8 ms 764 KB Output is correct
36 Correct 10 ms 604 KB Output is correct
37 Correct 9 ms 592 KB Output is correct
38 Correct 11 ms 568 KB Output is correct
39 Correct 9 ms 592 KB Output is correct
40 Correct 9 ms 592 KB Output is correct
41 Correct 8 ms 592 KB Output is correct
42 Correct 8 ms 592 KB Output is correct
43 Correct 9 ms 592 KB Output is correct
44 Correct 8 ms 592 KB Output is correct
45 Correct 8 ms 572 KB Output is correct
46 Correct 11 ms 592 KB Output is correct
47 Correct 10 ms 592 KB Output is correct
48 Correct 10 ms 592 KB Output is correct
49 Correct 10 ms 748 KB Output is correct
50 Correct 10 ms 592 KB Output is correct
51 Correct 10 ms 720 KB Output is correct
52 Correct 10 ms 604 KB Output is correct
53 Correct 10 ms 592 KB Output is correct
54 Correct 10 ms 592 KB Output is correct
55 Correct 9 ms 592 KB Output is correct
56 Correct 10 ms 592 KB Output is correct
57 Correct 10 ms 924 KB Output is correct
58 Correct 14 ms 592 KB Output is correct
59 Correct 10 ms 760 KB Output is correct
60 Correct 10 ms 592 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 500 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 504 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 0 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 0 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 504 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 0 ms 336 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 508 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
31 Correct 11 ms 2796 KB Output is correct
32 Correct 10 ms 2796 KB Output is correct
33 Correct 11 ms 2796 KB Output is correct
34 Correct 10 ms 2816 KB Output is correct
35 Correct 9 ms 2776 KB Output is correct
36 Correct 9 ms 2796 KB Output is correct
37 Correct 9 ms 2796 KB Output is correct
38 Correct 8 ms 2796 KB Output is correct
39 Correct 9 ms 2796 KB Output is correct
40 Correct 9 ms 2796 KB Output is correct
41 Correct 9 ms 2796 KB Output is correct
42 Correct 10 ms 2796 KB Output is correct
43 Correct 10 ms 2796 KB Output is correct
44 Correct 9 ms 2968 KB Output is correct
45 Correct 10 ms 2796 KB Output is correct
46 Correct 8 ms 592 KB Output is correct
47 Correct 9 ms 592 KB Output is correct
48 Correct 9 ms 760 KB Output is correct
49 Correct 8 ms 592 KB Output is correct
50 Correct 8 ms 764 KB Output is correct
51 Correct 10 ms 604 KB Output is correct
52 Correct 9 ms 592 KB Output is correct
53 Correct 11 ms 568 KB Output is correct
54 Correct 9 ms 592 KB Output is correct
55 Correct 9 ms 592 KB Output is correct
56 Correct 8 ms 592 KB Output is correct
57 Correct 8 ms 592 KB Output is correct
58 Correct 9 ms 592 KB Output is correct
59 Correct 8 ms 592 KB Output is correct
60 Correct 8 ms 572 KB Output is correct
61 Correct 11 ms 592 KB Output is correct
62 Correct 10 ms 592 KB Output is correct
63 Correct 10 ms 592 KB Output is correct
64 Correct 10 ms 748 KB Output is correct
65 Correct 10 ms 592 KB Output is correct
66 Correct 10 ms 720 KB Output is correct
67 Correct 10 ms 604 KB Output is correct
68 Correct 10 ms 592 KB Output is correct
69 Correct 10 ms 592 KB Output is correct
70 Correct 9 ms 592 KB Output is correct
71 Correct 10 ms 592 KB Output is correct
72 Correct 10 ms 924 KB Output is correct
73 Correct 14 ms 592 KB Output is correct
74 Correct 10 ms 760 KB Output is correct
75 Correct 10 ms 592 KB Output is correct
76 Correct 113 ms 8540 KB Output is correct
77 Correct 115 ms 16352 KB Output is correct
78 Correct 115 ms 16028 KB Output is correct
79 Correct 116 ms 16112 KB Output is correct
80 Correct 114 ms 15988 KB Output is correct
81 Correct 119 ms 15992 KB Output is correct
82 Correct 119 ms 16000 KB Output is correct
83 Correct 126 ms 16004 KB Output is correct
84 Correct 126 ms 15956 KB Output is correct
85 Correct 137 ms 16068 KB Output is correct
86 Correct 131 ms 16344 KB Output is correct
87 Correct 139 ms 16344 KB Output is correct
88 Correct 124 ms 16532 KB Output is correct
89 Correct 136 ms 15976 KB Output is correct
90 Correct 124 ms 16344 KB Output is correct