답안 #888486

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
888486 2023-12-17T14:21:15 Z fanwen Bliskost (COI23_bliskost) C++17
57 / 100
879 ms 25852 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, c[MAX];

bool check() {
	if(1LL * n * q > 1e8) return false;
	for (int i = 1; i <= n; ++i) {
		c[i] = a[i];
	}


	for (int i = 1; i < n; ++i) {
		int d = (b[i] - c[i] + 26) % 26;
		c[i] = b[i];
		c[i + 1] += d;
		c[i + 1] %= 26;
	}
	return c[n] == b[n];
}

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

    cout << (check() ? "da" : "ne") << '\n';
    while(q--) {
    	int p; char x; cin >> p >> x;
    	a[p] = x - 'a';
	    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:56:5: note: in expansion of macro 'file'
   56 |     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:56:5: note: in expansion of macro 'file'
   56 |     file("bliskost");
      |     ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4440 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4440 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4440 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Correct 1 ms 4444 KB Output is correct
22 Correct 1 ms 4444 KB Output is correct
23 Correct 1 ms 4444 KB Output is correct
24 Correct 1 ms 4444 KB Output is correct
25 Correct 1 ms 4444 KB Output is correct
26 Correct 1 ms 4444 KB Output is correct
27 Correct 1 ms 4444 KB Output is correct
28 Correct 1 ms 4444 KB Output is correct
29 Correct 1 ms 4444 KB Output is correct
30 Correct 1 ms 4440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4440 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4440 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Correct 1 ms 4444 KB Output is correct
22 Correct 1 ms 4444 KB Output is correct
23 Correct 1 ms 4444 KB Output is correct
24 Correct 1 ms 4444 KB Output is correct
25 Correct 1 ms 4444 KB Output is correct
26 Correct 1 ms 4444 KB Output is correct
27 Correct 1 ms 4444 KB Output is correct
28 Correct 1 ms 4444 KB Output is correct
29 Correct 1 ms 4444 KB Output is correct
30 Correct 1 ms 4440 KB Output is correct
31 Correct 27 ms 13692 KB Output is correct
32 Correct 27 ms 13916 KB Output is correct
33 Correct 28 ms 13652 KB Output is correct
34 Correct 28 ms 13736 KB Output is correct
35 Correct 27 ms 13916 KB Output is correct
36 Correct 28 ms 13808 KB Output is correct
37 Correct 27 ms 13916 KB Output is correct
38 Correct 30 ms 13904 KB Output is correct
39 Correct 29 ms 14132 KB Output is correct
40 Correct 27 ms 13904 KB Output is correct
41 Correct 28 ms 13916 KB Output is correct
42 Correct 27 ms 14120 KB Output is correct
43 Correct 27 ms 13916 KB Output is correct
44 Correct 27 ms 13904 KB Output is correct
45 Correct 27 ms 14088 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4440 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 12 ms 4696 KB Output is correct
17 Correct 14 ms 4700 KB Output is correct
18 Correct 12 ms 4648 KB Output is correct
19 Correct 13 ms 4700 KB Output is correct
20 Correct 12 ms 4696 KB Output is correct
21 Correct 13 ms 4700 KB Output is correct
22 Correct 13 ms 4712 KB Output is correct
23 Correct 12 ms 4700 KB Output is correct
24 Correct 12 ms 4700 KB Output is correct
25 Correct 12 ms 4696 KB Output is correct
26 Correct 12 ms 4696 KB Output is correct
27 Correct 12 ms 4700 KB Output is correct
28 Correct 15 ms 4696 KB Output is correct
29 Correct 12 ms 4700 KB Output is correct
30 Correct 13 ms 4700 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4440 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4440 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Correct 1 ms 4444 KB Output is correct
22 Correct 1 ms 4444 KB Output is correct
23 Correct 1 ms 4444 KB Output is correct
24 Correct 1 ms 4444 KB Output is correct
25 Correct 1 ms 4444 KB Output is correct
26 Correct 1 ms 4444 KB Output is correct
27 Correct 1 ms 4444 KB Output is correct
28 Correct 1 ms 4444 KB Output is correct
29 Correct 1 ms 4444 KB Output is correct
30 Correct 1 ms 4440 KB Output is correct
31 Correct 12 ms 4696 KB Output is correct
32 Correct 14 ms 4700 KB Output is correct
33 Correct 12 ms 4648 KB Output is correct
34 Correct 13 ms 4700 KB Output is correct
35 Correct 12 ms 4696 KB Output is correct
36 Correct 13 ms 4700 KB Output is correct
37 Correct 13 ms 4712 KB Output is correct
38 Correct 12 ms 4700 KB Output is correct
39 Correct 12 ms 4700 KB Output is correct
40 Correct 12 ms 4696 KB Output is correct
41 Correct 12 ms 4696 KB Output is correct
42 Correct 12 ms 4700 KB Output is correct
43 Correct 15 ms 4696 KB Output is correct
44 Correct 12 ms 4700 KB Output is correct
45 Correct 13 ms 4700 KB Output is correct
46 Correct 728 ms 4812 KB Output is correct
47 Correct 720 ms 4828 KB Output is correct
48 Correct 708 ms 4688 KB Output is correct
49 Correct 706 ms 5072 KB Output is correct
50 Correct 720 ms 4692 KB Output is correct
51 Correct 714 ms 4832 KB Output is correct
52 Correct 728 ms 5152 KB Output is correct
53 Correct 704 ms 5200 KB Output is correct
54 Correct 718 ms 4864 KB Output is correct
55 Correct 704 ms 4840 KB Output is correct
56 Correct 701 ms 4948 KB Output is correct
57 Correct 714 ms 4924 KB Output is correct
58 Correct 713 ms 5052 KB Output is correct
59 Correct 727 ms 4948 KB Output is correct
60 Correct 714 ms 4812 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4440 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4440 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Correct 1 ms 4444 KB Output is correct
22 Correct 1 ms 4444 KB Output is correct
23 Correct 1 ms 4444 KB Output is correct
24 Correct 1 ms 4444 KB Output is correct
25 Correct 1 ms 4444 KB Output is correct
26 Correct 1 ms 4444 KB Output is correct
27 Correct 1 ms 4444 KB Output is correct
28 Correct 1 ms 4444 KB Output is correct
29 Correct 1 ms 4444 KB Output is correct
30 Correct 1 ms 4440 KB Output is correct
31 Correct 27 ms 13692 KB Output is correct
32 Correct 27 ms 13916 KB Output is correct
33 Correct 28 ms 13652 KB Output is correct
34 Correct 28 ms 13736 KB Output is correct
35 Correct 27 ms 13916 KB Output is correct
36 Correct 28 ms 13808 KB Output is correct
37 Correct 27 ms 13916 KB Output is correct
38 Correct 30 ms 13904 KB Output is correct
39 Correct 29 ms 14132 KB Output is correct
40 Correct 27 ms 13904 KB Output is correct
41 Correct 28 ms 13916 KB Output is correct
42 Correct 27 ms 14120 KB Output is correct
43 Correct 27 ms 13916 KB Output is correct
44 Correct 27 ms 13904 KB Output is correct
45 Correct 27 ms 14088 KB Output is correct
46 Correct 12 ms 4696 KB Output is correct
47 Correct 14 ms 4700 KB Output is correct
48 Correct 12 ms 4648 KB Output is correct
49 Correct 13 ms 4700 KB Output is correct
50 Correct 12 ms 4696 KB Output is correct
51 Correct 13 ms 4700 KB Output is correct
52 Correct 13 ms 4712 KB Output is correct
53 Correct 12 ms 4700 KB Output is correct
54 Correct 12 ms 4700 KB Output is correct
55 Correct 12 ms 4696 KB Output is correct
56 Correct 12 ms 4696 KB Output is correct
57 Correct 12 ms 4700 KB Output is correct
58 Correct 15 ms 4696 KB Output is correct
59 Correct 12 ms 4700 KB Output is correct
60 Correct 13 ms 4700 KB Output is correct
61 Correct 728 ms 4812 KB Output is correct
62 Correct 720 ms 4828 KB Output is correct
63 Correct 708 ms 4688 KB Output is correct
64 Correct 706 ms 5072 KB Output is correct
65 Correct 720 ms 4692 KB Output is correct
66 Correct 714 ms 4832 KB Output is correct
67 Correct 728 ms 5152 KB Output is correct
68 Correct 704 ms 5200 KB Output is correct
69 Correct 718 ms 4864 KB Output is correct
70 Correct 704 ms 4840 KB Output is correct
71 Correct 701 ms 4948 KB Output is correct
72 Correct 714 ms 4924 KB Output is correct
73 Correct 713 ms 5052 KB Output is correct
74 Correct 727 ms 4948 KB Output is correct
75 Correct 714 ms 4812 KB Output is correct
76 Incorrect 879 ms 25852 KB Output isn't correct
77 Halted 0 ms 0 KB -