답안 #1013269

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1013269 2024-07-03T11:09:32 Z amine_aroua Bliskost (COI23_bliskost) C++17
57 / 100
1000 ms 12260 KB
#include <bits/stdc++.h>
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
using namespace std;
#define int long long
#define nl '\n'
#define pb push_back

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n , q;
    cin>>n>>q;
    string s , t;
    cin>>s>>t;
    s = '.' + s;
    t = '.' + t;
    vector<int> a(n);
    a[0] = 0;
    for(int i = 1 ; i <= n - 1 ; i++)
    {
        a[i] = (t[i] - s[i] - a[i - 1] + 2 * 26)%26;
    }
    if(a[n - 1] == (t[n] - s[n] + 26)%26)
        cout<<"da"<<nl;
    else
        cout<<"ne"<<nl;
    while(q--)
    {
        int i;
        char c;
        cin>>i>>c;
        int diff = (s[i] - c + 26)%26;
        s[i] = c;
        for(int j = i ; j <= n - 1 ; j++)
        {
            if((j - i)%2 == 0)
            {
                a[j] = (a[j] + diff)%26;
            }
            else
            {
                a[j] = (a[j] - diff + 26)%26;
            }
        }
        if(a[n - 1] == (t[n] - s[n] + 26)%26)
            cout<<"da"<<nl;
        else
            cout<<"ne"<<nl;
    }
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 456 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 600 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 1 ms 456 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 456 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 600 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 1 ms 456 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 9 ms 12012 KB Output is correct
32 Correct 9 ms 12008 KB Output is correct
33 Correct 9 ms 12024 KB Output is correct
34 Correct 8 ms 12088 KB Output is correct
35 Correct 8 ms 12216 KB Output is correct
36 Correct 9 ms 12112 KB Output is correct
37 Correct 9 ms 12116 KB Output is correct
38 Correct 8 ms 12020 KB Output is correct
39 Correct 9 ms 12120 KB Output is correct
40 Correct 9 ms 12160 KB Output is correct
41 Correct 9 ms 12136 KB Output is correct
42 Correct 9 ms 12004 KB Output is correct
43 Correct 10 ms 12120 KB Output is correct
44 Correct 10 ms 12028 KB Output is correct
45 Correct 8 ms 12016 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 8 ms 1116 KB Output is correct
17 Correct 8 ms 1112 KB Output is correct
18 Correct 8 ms 1116 KB Output is correct
19 Correct 8 ms 1032 KB Output is correct
20 Correct 9 ms 1116 KB Output is correct
21 Correct 7 ms 964 KB Output is correct
22 Correct 8 ms 1116 KB Output is correct
23 Correct 8 ms 952 KB Output is correct
24 Correct 8 ms 1116 KB Output is correct
25 Correct 7 ms 1116 KB Output is correct
26 Correct 8 ms 1112 KB Output is correct
27 Correct 8 ms 1116 KB Output is correct
28 Correct 9 ms 1116 KB Output is correct
29 Correct 13 ms 1116 KB Output is correct
30 Correct 8 ms 1116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 456 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 600 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 1 ms 456 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 8 ms 1116 KB Output is correct
32 Correct 8 ms 1112 KB Output is correct
33 Correct 8 ms 1116 KB Output is correct
34 Correct 8 ms 1032 KB Output is correct
35 Correct 9 ms 1116 KB Output is correct
36 Correct 7 ms 964 KB Output is correct
37 Correct 8 ms 1116 KB Output is correct
38 Correct 8 ms 952 KB Output is correct
39 Correct 8 ms 1116 KB Output is correct
40 Correct 7 ms 1116 KB Output is correct
41 Correct 8 ms 1112 KB Output is correct
42 Correct 8 ms 1116 KB Output is correct
43 Correct 9 ms 1116 KB Output is correct
44 Correct 13 ms 1116 KB Output is correct
45 Correct 8 ms 1116 KB Output is correct
46 Correct 86 ms 1108 KB Output is correct
47 Correct 90 ms 1180 KB Output is correct
48 Correct 84 ms 1108 KB Output is correct
49 Correct 91 ms 1104 KB Output is correct
50 Correct 87 ms 1108 KB Output is correct
51 Correct 84 ms 1264 KB Output is correct
52 Correct 85 ms 1104 KB Output is correct
53 Correct 91 ms 1116 KB Output is correct
54 Correct 88 ms 1108 KB Output is correct
55 Correct 85 ms 1108 KB Output is correct
56 Correct 83 ms 1292 KB Output is correct
57 Correct 79 ms 1104 KB Output is correct
58 Correct 90 ms 1128 KB Output is correct
59 Correct 94 ms 1116 KB Output is correct
60 Correct 94 ms 1108 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 456 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 600 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 1 ms 456 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 9 ms 12012 KB Output is correct
32 Correct 9 ms 12008 KB Output is correct
33 Correct 9 ms 12024 KB Output is correct
34 Correct 8 ms 12088 KB Output is correct
35 Correct 8 ms 12216 KB Output is correct
36 Correct 9 ms 12112 KB Output is correct
37 Correct 9 ms 12116 KB Output is correct
38 Correct 8 ms 12020 KB Output is correct
39 Correct 9 ms 12120 KB Output is correct
40 Correct 9 ms 12160 KB Output is correct
41 Correct 9 ms 12136 KB Output is correct
42 Correct 9 ms 12004 KB Output is correct
43 Correct 10 ms 12120 KB Output is correct
44 Correct 10 ms 12028 KB Output is correct
45 Correct 8 ms 12016 KB Output is correct
46 Correct 8 ms 1116 KB Output is correct
47 Correct 8 ms 1112 KB Output is correct
48 Correct 8 ms 1116 KB Output is correct
49 Correct 8 ms 1032 KB Output is correct
50 Correct 9 ms 1116 KB Output is correct
51 Correct 7 ms 964 KB Output is correct
52 Correct 8 ms 1116 KB Output is correct
53 Correct 8 ms 952 KB Output is correct
54 Correct 8 ms 1116 KB Output is correct
55 Correct 7 ms 1116 KB Output is correct
56 Correct 8 ms 1112 KB Output is correct
57 Correct 8 ms 1116 KB Output is correct
58 Correct 9 ms 1116 KB Output is correct
59 Correct 13 ms 1116 KB Output is correct
60 Correct 8 ms 1116 KB Output is correct
61 Correct 86 ms 1108 KB Output is correct
62 Correct 90 ms 1180 KB Output is correct
63 Correct 84 ms 1108 KB Output is correct
64 Correct 91 ms 1104 KB Output is correct
65 Correct 87 ms 1108 KB Output is correct
66 Correct 84 ms 1264 KB Output is correct
67 Correct 85 ms 1104 KB Output is correct
68 Correct 91 ms 1116 KB Output is correct
69 Correct 88 ms 1108 KB Output is correct
70 Correct 85 ms 1108 KB Output is correct
71 Correct 83 ms 1292 KB Output is correct
72 Correct 79 ms 1104 KB Output is correct
73 Correct 90 ms 1128 KB Output is correct
74 Correct 94 ms 1116 KB Output is correct
75 Correct 94 ms 1108 KB Output is correct
76 Execution timed out 1006 ms 12260 KB Time limit exceeded
77 Halted 0 ms 0 KB -