Submission #1107649

# Submission time Handle Problem Language Result Execution time Memory
1107649 2024-11-01T19:37:19 Z 0pt1mus23 Bliskost (COI23_bliskost) C++14
28 / 100
13 ms 12524 KB
// HELLLLLLLNAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define ins insert      
#define pb push_back
#define endl '\n'
#define putr(x) cout<<x<<endl;return; 
#define all(x) x.begin(),x.end()
const int mod = 1e9 +7, sze = 1e5 +5, inf = INT_MAX, LL = 30;

void rush(){
    int n,q;
    cin>>n>>q;
    string s,t;
    cin>>s>>t;
    vector<int> pref(n,0);
    for(int i=0;i<n;i++){
        pref[i]=(t[i]-s[i] + 26)%26;    
        if(i){
            pref[i]=(-pref[i-1] + pref[i] + 26)%26;
        }
    }
    if(pref.back()==0){
        cout<<"da\n";
    }
    else{
        cout<<"ne\n";
    }
    int tot = 0;
    while(q--){
        int idx;
        cin>>idx;
        char c;
        cin>>c;
        --idx;
        int diff = c - s[idx];
        cout<<diff<<endl;
        s[idx]=c;
        if((n-idx)&1){
            pref.back()=(pref.back() + 26  - diff)%26; 
        }
        else{
            pref.back()=(pref.back() + diff)%26;
        }
        if(pref.back()==0){
            cout<<"da\n";
        }
        else{
            cout<<"ne\n";
        }
    }    
    /*
    
    amelelik : 

    ab | bb
    pref: 1 25

    2 a , -1, b->b, b->a->b
    perf : 1 0 
    ferq tek olanda, last positiona tesir elemir
    
    1 b : 1,  aa -. ba
    pref : 0,1
    */
}

signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);

    int tt = 1; 
    // cin>>tt;

    while(tt--){
        rush();
    }

    return 0;
}

Compilation message

Main.cpp: In function 'void rush()':
Main.cpp:30:9: warning: unused variable 'tot' [-Wunused-variable]
   30 |     int tot = 0;
      |         ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 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 336 KB Output is correct
6 Correct 1 ms 504 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 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 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 336 KB Output is correct
6 Correct 1 ms 504 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 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 508 KB Output is correct
20 Correct 1 ms 464 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 592 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 508 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 336 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 336 KB Output is correct
6 Correct 1 ms 504 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 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 508 KB Output is correct
20 Correct 1 ms 464 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 592 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 508 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 13 ms 12076 KB Output is correct
32 Correct 12 ms 12160 KB Output is correct
33 Correct 12 ms 12136 KB Output is correct
34 Correct 12 ms 12240 KB Output is correct
35 Correct 13 ms 12416 KB Output is correct
36 Correct 12 ms 12520 KB Output is correct
37 Correct 12 ms 12520 KB Output is correct
38 Correct 13 ms 12496 KB Output is correct
39 Correct 12 ms 12524 KB Output is correct
40 Correct 13 ms 12512 KB Output is correct
41 Correct 13 ms 12340 KB Output is correct
42 Correct 12 ms 12160 KB Output is correct
43 Correct 12 ms 12524 KB Output is correct
44 Correct 11 ms 12192 KB Output is correct
45 Correct 13 ms 12232 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 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 336 KB Output is correct
6 Correct 1 ms 504 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 336 KB Output is correct
16 Incorrect 13 ms 1360 KB Output isn't correct
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 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 336 KB Output is correct
6 Correct 1 ms 504 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 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 508 KB Output is correct
20 Correct 1 ms 464 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 592 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 508 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 Incorrect 13 ms 1360 KB Output isn't correct
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 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 336 KB Output is correct
6 Correct 1 ms 504 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 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 508 KB Output is correct
20 Correct 1 ms 464 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 592 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 508 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 13 ms 12076 KB Output is correct
32 Correct 12 ms 12160 KB Output is correct
33 Correct 12 ms 12136 KB Output is correct
34 Correct 12 ms 12240 KB Output is correct
35 Correct 13 ms 12416 KB Output is correct
36 Correct 12 ms 12520 KB Output is correct
37 Correct 12 ms 12520 KB Output is correct
38 Correct 13 ms 12496 KB Output is correct
39 Correct 12 ms 12524 KB Output is correct
40 Correct 13 ms 12512 KB Output is correct
41 Correct 13 ms 12340 KB Output is correct
42 Correct 12 ms 12160 KB Output is correct
43 Correct 12 ms 12524 KB Output is correct
44 Correct 11 ms 12192 KB Output is correct
45 Correct 13 ms 12232 KB Output is correct
46 Incorrect 13 ms 1360 KB Output isn't correct
47 Halted 0 ms 0 KB -