Submission #959862

# Submission time Handle Problem Language Result Execution time Memory
959862 2024-04-09T08:48:35 Z ramalzaher Bliskost (COI23_bliskost) C++14
28 / 100
69 ms 24052 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
class BIT {
    vector<int> bit;
    int size;
    
    public:
        BIT(int n, vector<int> vals) {
            bit.resize(n+1,0);
            size=n;
            for (int i=1; i<=n; i++) {
                update(i,vals[i]);
            }
        }
        
        void update(int pos, int val) {
            while (pos<=size) {
                bit[pos]+=val;
                pos+=pos&-pos;
            }
        }
        
        int query(int pos) {
            int ans=0;
            while (pos>0) {
                ans+=bit[pos];
                pos-=pos&-pos;
            }
            return ans;
        }
};
 
int main() {
    int n,q; cin>>n>>q;
    string a,b; cin>>a>>b;
    vector<int> va, vb;
    va.push_back(0);
    vb.push_back(0);
    for (int i=1; i<=n; i++) {
        if (n%2==i%2) {
            va.push_back(a[i-1]-'a'+1);
            vb.push_back(b[i-1]-'a'+1);
        } else {
            va.push_back(-(a[i-1]-'a'+1));
            vb.push_back(-(b[i-1]-'a'+1));
        }
    }
    BIT fa=BIT(n,va);
    BIT fb=BIT(n,vb);
    if ((fa.query(n)-fb.query(n))%26==0) cout<<"da\n";
    else cout<<"ne\n";
//    while (q--) {
//        int p; char a; cin>>p>>a;
//        if (n%2==p%2) fa.update(p,(a-'a'+1)-va[p]);
//        else fa.update(p,-(a-'a'+1)-va[p]);
//        va[p]=a-'a'+1;
//        if ((fa.query(n)-fb.query(n))%26==0) cout<<"da\n";
//        else cout<<"ne\n";
//    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 600 KB Output is correct
3 Correct 0 ms 500 KB Output is correct
4 Correct 0 ms 600 KB Output is correct
5 Correct 0 ms 432 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 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 600 KB Output is correct
3 Correct 0 ms 500 KB Output is correct
4 Correct 0 ms 600 KB Output is correct
5 Correct 0 ms 432 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 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 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 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 0 ms 516 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 348 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
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 600 KB Output is correct
3 Correct 0 ms 500 KB Output is correct
4 Correct 0 ms 600 KB Output is correct
5 Correct 0 ms 432 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 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 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 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 0 ms 516 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 348 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 56 ms 23796 KB Output is correct
32 Correct 59 ms 23792 KB Output is correct
33 Correct 57 ms 23888 KB Output is correct
34 Correct 68 ms 23792 KB Output is correct
35 Correct 55 ms 23840 KB Output is correct
36 Correct 58 ms 23800 KB Output is correct
37 Correct 57 ms 23856 KB Output is correct
38 Correct 56 ms 23928 KB Output is correct
39 Correct 56 ms 23916 KB Output is correct
40 Correct 56 ms 23796 KB Output is correct
41 Correct 57 ms 23880 KB Output is correct
42 Correct 57 ms 23968 KB Output is correct
43 Correct 69 ms 24052 KB Output is correct
44 Correct 56 ms 23828 KB Output is correct
45 Correct 57 ms 23888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 600 KB Output is correct
3 Correct 0 ms 500 KB Output is correct
4 Correct 0 ms 600 KB Output is correct
5 Correct 0 ms 432 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 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Incorrect 0 ms 348 KB Output isn't correct
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 600 KB Output is correct
3 Correct 0 ms 500 KB Output is correct
4 Correct 0 ms 600 KB Output is correct
5 Correct 0 ms 432 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 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 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 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 0 ms 516 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 348 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 Incorrect 0 ms 348 KB Output isn't correct
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 600 KB Output is correct
3 Correct 0 ms 500 KB Output is correct
4 Correct 0 ms 600 KB Output is correct
5 Correct 0 ms 432 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 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 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 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 0 ms 516 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 348 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 56 ms 23796 KB Output is correct
32 Correct 59 ms 23792 KB Output is correct
33 Correct 57 ms 23888 KB Output is correct
34 Correct 68 ms 23792 KB Output is correct
35 Correct 55 ms 23840 KB Output is correct
36 Correct 58 ms 23800 KB Output is correct
37 Correct 57 ms 23856 KB Output is correct
38 Correct 56 ms 23928 KB Output is correct
39 Correct 56 ms 23916 KB Output is correct
40 Correct 56 ms 23796 KB Output is correct
41 Correct 57 ms 23880 KB Output is correct
42 Correct 57 ms 23968 KB Output is correct
43 Correct 69 ms 24052 KB Output is correct
44 Correct 56 ms 23828 KB Output is correct
45 Correct 57 ms 23888 KB Output is correct
46 Incorrect 0 ms 348 KB Output isn't correct
47 Halted 0 ms 0 KB -