Submission #1112514

# Submission time Handle Problem Language Result Execution time Memory
1112514 2024-11-14T09:18:07 Z vjudge1 Bliskost (COI23_bliskost) C++17
57 / 100
1000 ms 6848 KB
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define nmod(a, b) (((a%b)+b)%b) // stands for [n]atural [mod], as in "will always return a natural number", should be used in case of negative
#define a2b(a, b) (a << b) // a*2^b
#define bit(a, b) ((a >> b) & 1) // bth bit from the right, starts at zero
using namespace std;
template<class T> using vec = vector<T>;

const int INFTY = (1LL << 63) - 1;
const int NNFTY = 1LL << 63;

bool sim(string s1, string s2) {
    int n = s1.size();
    if (n != s2.size()) return false;
    int lastdiff = 0;
    for (int i = 0; i < n - 1; i++) {
        lastdiff = s1[i] - s2[i] - lastdiff;
        lastdiff = nmod(lastdiff, 26);
        if (i == n - 2 && lastdiff != nmod(s1[n - 1] - s2[n - 1], 26)) return false;
    }
    return true;
}

int32_t main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n, q; cin >> n >> q;
    string s1, s2; cin >> s1 >> s2;
    cout << "ne\n\0da\n" + 4*sim(s1, s2);
    while (q--) {
        int i; char c; cin >> i >> c; i--;
        s1[i] = c;
        cout << "ne\n\0da\n" + 4*sim(s1, s2);
    }
}

Compilation message

Main.cpp:10:31: warning: integer overflow in expression of type 'long long int' results in '9223372036854775807' [-Woverflow]
   10 | const int INFTY = (1LL << 63) - 1;
      |                   ~~~~~~~~~~~~^~~
Main.cpp: In function 'bool sim(std::string, std::string)':
Main.cpp:15:11: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     if (n != s2.size()) return false;
      |         ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 460 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 508 KB Output is correct
6 Correct 1 ms 592 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 1 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 500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 460 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 508 KB Output is correct
6 Correct 1 ms 592 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 1 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 500 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 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 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 336 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 456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 460 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 508 KB Output is correct
6 Correct 1 ms 592 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 1 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 500 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 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 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 336 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 456 KB Output is correct
31 Correct 14 ms 6272 KB Output is correct
32 Correct 14 ms 6272 KB Output is correct
33 Correct 15 ms 6548 KB Output is correct
34 Correct 14 ms 6336 KB Output is correct
35 Correct 14 ms 6272 KB Output is correct
36 Correct 14 ms 6800 KB Output is correct
37 Correct 14 ms 6632 KB Output is correct
38 Correct 14 ms 6288 KB Output is correct
39 Correct 14 ms 6636 KB Output is correct
40 Correct 14 ms 6848 KB Output is correct
41 Correct 15 ms 6284 KB Output is correct
42 Correct 15 ms 6272 KB Output is correct
43 Correct 18 ms 6636 KB Output is correct
44 Correct 14 ms 6304 KB Output is correct
45 Correct 14 ms 6468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 460 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 508 KB Output is correct
6 Correct 1 ms 592 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 1 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 500 KB Output is correct
16 Correct 11 ms 1104 KB Output is correct
17 Correct 11 ms 1104 KB Output is correct
18 Correct 11 ms 1104 KB Output is correct
19 Correct 11 ms 1104 KB Output is correct
20 Correct 11 ms 1272 KB Output is correct
21 Correct 11 ms 1272 KB Output is correct
22 Correct 11 ms 1104 KB Output is correct
23 Correct 15 ms 1104 KB Output is correct
24 Correct 11 ms 1104 KB Output is correct
25 Correct 11 ms 1104 KB Output is correct
26 Correct 11 ms 1104 KB Output is correct
27 Correct 11 ms 1116 KB Output is correct
28 Correct 11 ms 1104 KB Output is correct
29 Correct 11 ms 1104 KB Output is correct
30 Correct 11 ms 1104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 460 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 508 KB Output is correct
6 Correct 1 ms 592 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 1 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 500 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 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 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 336 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 456 KB Output is correct
31 Correct 11 ms 1104 KB Output is correct
32 Correct 11 ms 1104 KB Output is correct
33 Correct 11 ms 1104 KB Output is correct
34 Correct 11 ms 1104 KB Output is correct
35 Correct 11 ms 1272 KB Output is correct
36 Correct 11 ms 1272 KB Output is correct
37 Correct 11 ms 1104 KB Output is correct
38 Correct 15 ms 1104 KB Output is correct
39 Correct 11 ms 1104 KB Output is correct
40 Correct 11 ms 1104 KB Output is correct
41 Correct 11 ms 1104 KB Output is correct
42 Correct 11 ms 1116 KB Output is correct
43 Correct 11 ms 1104 KB Output is correct
44 Correct 11 ms 1104 KB Output is correct
45 Correct 11 ms 1104 KB Output is correct
46 Correct 698 ms 1280 KB Output is correct
47 Correct 690 ms 1292 KB Output is correct
48 Correct 675 ms 1096 KB Output is correct
49 Correct 676 ms 1272 KB Output is correct
50 Correct 692 ms 1232 KB Output is correct
51 Correct 686 ms 1240 KB Output is correct
52 Correct 702 ms 1360 KB Output is correct
53 Correct 671 ms 1172 KB Output is correct
54 Correct 691 ms 1344 KB Output is correct
55 Correct 674 ms 1096 KB Output is correct
56 Correct 670 ms 1144 KB Output is correct
57 Correct 681 ms 1184 KB Output is correct
58 Correct 683 ms 1252 KB Output is correct
59 Correct 699 ms 1280 KB Output is correct
60 Correct 682 ms 1128 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 460 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 508 KB Output is correct
6 Correct 1 ms 592 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 1 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 500 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 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 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 336 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 456 KB Output is correct
31 Correct 14 ms 6272 KB Output is correct
32 Correct 14 ms 6272 KB Output is correct
33 Correct 15 ms 6548 KB Output is correct
34 Correct 14 ms 6336 KB Output is correct
35 Correct 14 ms 6272 KB Output is correct
36 Correct 14 ms 6800 KB Output is correct
37 Correct 14 ms 6632 KB Output is correct
38 Correct 14 ms 6288 KB Output is correct
39 Correct 14 ms 6636 KB Output is correct
40 Correct 14 ms 6848 KB Output is correct
41 Correct 15 ms 6284 KB Output is correct
42 Correct 15 ms 6272 KB Output is correct
43 Correct 18 ms 6636 KB Output is correct
44 Correct 14 ms 6304 KB Output is correct
45 Correct 14 ms 6468 KB Output is correct
46 Correct 11 ms 1104 KB Output is correct
47 Correct 11 ms 1104 KB Output is correct
48 Correct 11 ms 1104 KB Output is correct
49 Correct 11 ms 1104 KB Output is correct
50 Correct 11 ms 1272 KB Output is correct
51 Correct 11 ms 1272 KB Output is correct
52 Correct 11 ms 1104 KB Output is correct
53 Correct 15 ms 1104 KB Output is correct
54 Correct 11 ms 1104 KB Output is correct
55 Correct 11 ms 1104 KB Output is correct
56 Correct 11 ms 1104 KB Output is correct
57 Correct 11 ms 1116 KB Output is correct
58 Correct 11 ms 1104 KB Output is correct
59 Correct 11 ms 1104 KB Output is correct
60 Correct 11 ms 1104 KB Output is correct
61 Correct 698 ms 1280 KB Output is correct
62 Correct 690 ms 1292 KB Output is correct
63 Correct 675 ms 1096 KB Output is correct
64 Correct 676 ms 1272 KB Output is correct
65 Correct 692 ms 1232 KB Output is correct
66 Correct 686 ms 1240 KB Output is correct
67 Correct 702 ms 1360 KB Output is correct
68 Correct 671 ms 1172 KB Output is correct
69 Correct 691 ms 1344 KB Output is correct
70 Correct 674 ms 1096 KB Output is correct
71 Correct 670 ms 1144 KB Output is correct
72 Correct 681 ms 1184 KB Output is correct
73 Correct 683 ms 1252 KB Output is correct
74 Correct 699 ms 1280 KB Output is correct
75 Correct 682 ms 1128 KB Output is correct
76 Execution timed out 1062 ms 6632 KB Time limit exceeded
77 Halted 0 ms 0 KB -