답안 #888488

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
888488 2023-12-17T14:30:29 Z fanwen Bliskost (COI23_bliskost) C++17
100 / 100
153 ms 21992 KB
#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define ll long long
#define file(name)                  \
    if(fopen(name".inp", "r"))      \
        freopen(name".inp", "r", stdin), freopen(name".out", "w", stdout); 

const int MAX = 1e6 + 5;

int n, a[MAX], b[MAX], q;
long long sum[2];

bool check() {
	return (sum[0] - sum[1]) % 26 == 0;
}

void you_make_it(void) {
    cin >> n >> q;
    for (int i = 1; i <= n; ++i) {
    	char x; cin >> x; a[i] = x - 'a';
    	sum[i & 1] -= a[i];
    }
    for (int i = 1; i <= n; ++i) {
    	char x; cin >> x; b[i] = x - 'a';
    	sum[i & 1] += b[i];
    }

    cout << (check() ? "da" : "ne") << '\n';
    while(q--) {
    	int p; char x; cin >> p >> x;
    	sum[p & 1] += a[p];
    	a[p] = x - 'a';
    	sum[p & 1] -= a[p];
	    cout << (check() ? "da" : "ne") << '\n';

    }
}

signed main() {

#ifdef LOCAL
    freopen("TASK.inp", "r", stdin);
    freopen("TASK.out", "w", stdout);
#endif
    file("bliskost");
    auto start_time = chrono::steady_clock::now();

    cin.tie(0), cout.tie(0) -> sync_with_stdio(0);

    you_make_it();

    auto end_time = chrono::steady_clock::now();

    cerr << "\nExecution time : " << chrono::duration_cast <chrono::milliseconds> (end_time - start_time).count() << "[ms]" << endl;

    return (0 ^ 0);
}

// Dream it. Wish it. Do it.

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:10:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |         freopen(name".inp", "r", stdin), freopen(name".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:49:5: note: in expansion of macro 'file'
   49 |     file("bliskost");
      |     ^~~~
Main.cpp:10:49: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |         freopen(name".inp", "r", stdin), freopen(name".out", "w", stdout);
      |                                          ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:49:5: note: in expansion of macro 'file'
   49 |     file("bliskost");
      |     ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 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 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2392 KB Output is correct
17 Correct 1 ms 2436 KB Output is correct
18 Correct 1 ms 2392 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 0 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 1 ms 2396 KB Output is correct
26 Correct 0 ms 2396 KB Output is correct
27 Correct 0 ms 2396 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 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2392 KB Output is correct
17 Correct 1 ms 2436 KB Output is correct
18 Correct 1 ms 2392 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 0 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 1 ms 2396 KB Output is correct
26 Correct 0 ms 2396 KB Output is correct
27 Correct 0 ms 2396 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 20 ms 8024 KB Output is correct
32 Correct 19 ms 8284 KB Output is correct
33 Correct 18 ms 8284 KB Output is correct
34 Correct 19 ms 8280 KB Output is correct
35 Correct 18 ms 8284 KB Output is correct
36 Correct 19 ms 8028 KB Output is correct
37 Correct 18 ms 8280 KB Output is correct
38 Correct 19 ms 8028 KB Output is correct
39 Correct 19 ms 8280 KB Output is correct
40 Correct 19 ms 8284 KB Output is correct
41 Correct 19 ms 8284 KB Output is correct
42 Correct 21 ms 8536 KB Output is correct
43 Correct 19 ms 8280 KB Output is correct
44 Correct 19 ms 8284 KB Output is correct
45 Correct 19 ms 8192 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 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 10 ms 2652 KB Output is correct
17 Correct 10 ms 2800 KB Output is correct
18 Correct 10 ms 2652 KB Output is correct
19 Correct 10 ms 2676 KB Output is correct
20 Correct 10 ms 2908 KB Output is correct
21 Correct 10 ms 2652 KB Output is correct
22 Correct 10 ms 2652 KB Output is correct
23 Correct 10 ms 2652 KB Output is correct
24 Correct 13 ms 2652 KB Output is correct
25 Correct 10 ms 2652 KB Output is correct
26 Correct 10 ms 2656 KB Output is correct
27 Correct 10 ms 2652 KB Output is correct
28 Correct 10 ms 2652 KB Output is correct
29 Correct 10 ms 2652 KB Output is correct
30 Correct 10 ms 2652 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 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2392 KB Output is correct
17 Correct 1 ms 2436 KB Output is correct
18 Correct 1 ms 2392 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 0 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 1 ms 2396 KB Output is correct
26 Correct 0 ms 2396 KB Output is correct
27 Correct 0 ms 2396 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 10 ms 2652 KB Output is correct
32 Correct 10 ms 2800 KB Output is correct
33 Correct 10 ms 2652 KB Output is correct
34 Correct 10 ms 2676 KB Output is correct
35 Correct 10 ms 2908 KB Output is correct
36 Correct 10 ms 2652 KB Output is correct
37 Correct 10 ms 2652 KB Output is correct
38 Correct 10 ms 2652 KB Output is correct
39 Correct 13 ms 2652 KB Output is correct
40 Correct 10 ms 2652 KB Output is correct
41 Correct 10 ms 2656 KB Output is correct
42 Correct 10 ms 2652 KB Output is correct
43 Correct 10 ms 2652 KB Output is correct
44 Correct 10 ms 2652 KB Output is correct
45 Correct 10 ms 2652 KB Output is correct
46 Correct 10 ms 2648 KB Output is correct
47 Correct 10 ms 2652 KB Output is correct
48 Correct 10 ms 2652 KB Output is correct
49 Correct 10 ms 2648 KB Output is correct
50 Correct 11 ms 2648 KB Output is correct
51 Correct 11 ms 2652 KB Output is correct
52 Correct 10 ms 2652 KB Output is correct
53 Correct 11 ms 2824 KB Output is correct
54 Correct 11 ms 2652 KB Output is correct
55 Correct 11 ms 2648 KB Output is correct
56 Correct 11 ms 2652 KB Output is correct
57 Correct 10 ms 2644 KB Output is correct
58 Correct 10 ms 2652 KB Output is correct
59 Correct 11 ms 2648 KB Output is correct
60 Correct 10 ms 2652 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 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2392 KB Output is correct
17 Correct 1 ms 2436 KB Output is correct
18 Correct 1 ms 2392 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 0 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 1 ms 2396 KB Output is correct
26 Correct 0 ms 2396 KB Output is correct
27 Correct 0 ms 2396 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 20 ms 8024 KB Output is correct
32 Correct 19 ms 8284 KB Output is correct
33 Correct 18 ms 8284 KB Output is correct
34 Correct 19 ms 8280 KB Output is correct
35 Correct 18 ms 8284 KB Output is correct
36 Correct 19 ms 8028 KB Output is correct
37 Correct 18 ms 8280 KB Output is correct
38 Correct 19 ms 8028 KB Output is correct
39 Correct 19 ms 8280 KB Output is correct
40 Correct 19 ms 8284 KB Output is correct
41 Correct 19 ms 8284 KB Output is correct
42 Correct 21 ms 8536 KB Output is correct
43 Correct 19 ms 8280 KB Output is correct
44 Correct 19 ms 8284 KB Output is correct
45 Correct 19 ms 8192 KB Output is correct
46 Correct 10 ms 2652 KB Output is correct
47 Correct 10 ms 2800 KB Output is correct
48 Correct 10 ms 2652 KB Output is correct
49 Correct 10 ms 2676 KB Output is correct
50 Correct 10 ms 2908 KB Output is correct
51 Correct 10 ms 2652 KB Output is correct
52 Correct 10 ms 2652 KB Output is correct
53 Correct 10 ms 2652 KB Output is correct
54 Correct 13 ms 2652 KB Output is correct
55 Correct 10 ms 2652 KB Output is correct
56 Correct 10 ms 2656 KB Output is correct
57 Correct 10 ms 2652 KB Output is correct
58 Correct 10 ms 2652 KB Output is correct
59 Correct 10 ms 2652 KB Output is correct
60 Correct 10 ms 2652 KB Output is correct
61 Correct 10 ms 2648 KB Output is correct
62 Correct 10 ms 2652 KB Output is correct
63 Correct 10 ms 2652 KB Output is correct
64 Correct 10 ms 2648 KB Output is correct
65 Correct 11 ms 2648 KB Output is correct
66 Correct 11 ms 2652 KB Output is correct
67 Correct 10 ms 2652 KB Output is correct
68 Correct 11 ms 2824 KB Output is correct
69 Correct 11 ms 2652 KB Output is correct
70 Correct 11 ms 2648 KB Output is correct
71 Correct 11 ms 2652 KB Output is correct
72 Correct 10 ms 2644 KB Output is correct
73 Correct 10 ms 2652 KB Output is correct
74 Correct 11 ms 2648 KB Output is correct
75 Correct 10 ms 2652 KB Output is correct
76 Correct 136 ms 11088 KB Output is correct
77 Correct 139 ms 21708 KB Output is correct
78 Correct 153 ms 21992 KB Output is correct
79 Correct 137 ms 21840 KB Output is correct
80 Correct 141 ms 21876 KB Output is correct
81 Correct 137 ms 21844 KB Output is correct
82 Correct 138 ms 21844 KB Output is correct
83 Correct 138 ms 21740 KB Output is correct
84 Correct 138 ms 21792 KB Output is correct
85 Correct 138 ms 21840 KB Output is correct
86 Correct 136 ms 21844 KB Output is correct
87 Correct 136 ms 21700 KB Output is correct
88 Correct 148 ms 21788 KB Output is correct
89 Correct 136 ms 21844 KB Output is correct
90 Correct 137 ms 21712 KB Output is correct