답안 #955521

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
955521 2024-03-30T19:12:59 Z ZeroCool Bliskost (COI23_bliskost) C++14
100 / 100
166 ms 16568 KB
#include <bits/stdc++.h>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
   
using namespace std;
using namespace __gnu_pbds;
   
template <typename T>
using oset = tree<T,null_type,less<T>, rb_tree_tag, tree_order_statistics_node_update>;
   
#define int long long
       
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
       
#define endl '\n'

using ll = long long;
using ld = long double;
       
#define no cout<<"NO"<<endl
#define yes cout<<"YES"<<endl
     
#define da cout<<"da"<<endl
#define ne cout<<"ne"<<endl
       
#define send ios::sync_with_stdio(false);
#define help cin.tie(0);
       
void solve(int T);
       
const int N = 3e5 + 10;
const int M = 405;
const int SQRT = sqrt(N);
const int LOG = 20;
const int INF = 1e12;
const int MOD = 45678;
const ld EPS = 1e-9;
       
       
int ans;
int n, m, q, l, r, x, y, mx, mn;
       
       
int32_t main(){
    #ifdef ZC
        auto begin = chrono::high_resolution_clock::now();
    #endif
    cout<<setprecision(4)<<fixed;
           
    send help;
       
    int tt = 1;
  //cin>>tt; //? Comment if no testcases
    for(int i = 1;i<=tt;i++){
        #ifdef ZC
            cout<<"Case "<<i<<": "<<endl;
        #endif
        solve(i);
    }
    #ifdef ZC
        auto end = chrono::high_resolution_clock::now();
        cout<<"Time: "<<chrono::duration_cast<chrono::duration<double>>(end - begin).count()<<endl;
    #endif
    return 0;
}

string s, t;

inline int calc(int i){
    if(i & 1)return s[i] - t[i];
    else return t[i] - s[i];
}

void solve(int T){
    cin>>n>>q>>s>>t;

    int sum = 0;
    for(int i = 0;i<n;i++)sum += calc(i);

    if(sum % 26 == 0)da;
    else ne;

    while(q--){
        int p;
        char v;
        cin>>p>>v;
        --p;
        sum -= calc(p);
        s[p] = v;
        sum += calc(p);
        if(sum % 26 == 0)da;
        else ne;
    }
}  
//Te molam da raboti !!
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 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 348 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 344 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 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 348 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 344 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 0 ms 348 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 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 600 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 0 ms 344 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 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 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 348 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 344 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 0 ms 348 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 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 600 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 4 ms 2808 KB Output is correct
32 Correct 5 ms 2808 KB Output is correct
33 Correct 4 ms 2808 KB Output is correct
34 Correct 5 ms 2808 KB Output is correct
35 Correct 5 ms 2808 KB Output is correct
36 Correct 6 ms 2848 KB Output is correct
37 Correct 5 ms 3060 KB Output is correct
38 Correct 4 ms 2804 KB Output is correct
39 Correct 5 ms 2780 KB Output is correct
40 Correct 5 ms 2808 KB Output is correct
41 Correct 5 ms 2808 KB Output is correct
42 Correct 4 ms 2808 KB Output is correct
43 Correct 5 ms 2768 KB Output is correct
44 Correct 5 ms 2804 KB Output is correct
45 Correct 5 ms 2804 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 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 348 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 344 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 13 ms 604 KB Output is correct
17 Correct 11 ms 604 KB Output is correct
18 Correct 11 ms 600 KB Output is correct
19 Correct 11 ms 604 KB Output is correct
20 Correct 11 ms 604 KB Output is correct
21 Correct 11 ms 604 KB Output is correct
22 Correct 11 ms 604 KB Output is correct
23 Correct 11 ms 604 KB Output is correct
24 Correct 11 ms 604 KB Output is correct
25 Correct 11 ms 708 KB Output is correct
26 Correct 11 ms 600 KB Output is correct
27 Correct 14 ms 604 KB Output is correct
28 Correct 11 ms 604 KB Output is correct
29 Correct 11 ms 604 KB Output is correct
30 Correct 13 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 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 348 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 344 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 0 ms 348 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 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 600 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 13 ms 604 KB Output is correct
32 Correct 11 ms 604 KB Output is correct
33 Correct 11 ms 600 KB Output is correct
34 Correct 11 ms 604 KB Output is correct
35 Correct 11 ms 604 KB Output is correct
36 Correct 11 ms 604 KB Output is correct
37 Correct 11 ms 604 KB Output is correct
38 Correct 11 ms 604 KB Output is correct
39 Correct 11 ms 604 KB Output is correct
40 Correct 11 ms 708 KB Output is correct
41 Correct 11 ms 600 KB Output is correct
42 Correct 14 ms 604 KB Output is correct
43 Correct 11 ms 604 KB Output is correct
44 Correct 11 ms 604 KB Output is correct
45 Correct 13 ms 604 KB Output is correct
46 Correct 12 ms 604 KB Output is correct
47 Correct 12 ms 604 KB Output is correct
48 Correct 12 ms 604 KB Output is correct
49 Correct 12 ms 604 KB Output is correct
50 Correct 12 ms 600 KB Output is correct
51 Correct 12 ms 604 KB Output is correct
52 Correct 13 ms 860 KB Output is correct
53 Correct 12 ms 604 KB Output is correct
54 Correct 13 ms 604 KB Output is correct
55 Correct 13 ms 604 KB Output is correct
56 Correct 12 ms 604 KB Output is correct
57 Correct 12 ms 604 KB Output is correct
58 Correct 12 ms 700 KB Output is correct
59 Correct 12 ms 604 KB Output is correct
60 Correct 12 ms 688 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 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 348 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 344 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 0 ms 348 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 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 600 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 4 ms 2808 KB Output is correct
32 Correct 5 ms 2808 KB Output is correct
33 Correct 4 ms 2808 KB Output is correct
34 Correct 5 ms 2808 KB Output is correct
35 Correct 5 ms 2808 KB Output is correct
36 Correct 6 ms 2848 KB Output is correct
37 Correct 5 ms 3060 KB Output is correct
38 Correct 4 ms 2804 KB Output is correct
39 Correct 5 ms 2780 KB Output is correct
40 Correct 5 ms 2808 KB Output is correct
41 Correct 5 ms 2808 KB Output is correct
42 Correct 4 ms 2808 KB Output is correct
43 Correct 5 ms 2768 KB Output is correct
44 Correct 5 ms 2804 KB Output is correct
45 Correct 5 ms 2804 KB Output is correct
46 Correct 13 ms 604 KB Output is correct
47 Correct 11 ms 604 KB Output is correct
48 Correct 11 ms 600 KB Output is correct
49 Correct 11 ms 604 KB Output is correct
50 Correct 11 ms 604 KB Output is correct
51 Correct 11 ms 604 KB Output is correct
52 Correct 11 ms 604 KB Output is correct
53 Correct 11 ms 604 KB Output is correct
54 Correct 11 ms 604 KB Output is correct
55 Correct 11 ms 708 KB Output is correct
56 Correct 11 ms 600 KB Output is correct
57 Correct 14 ms 604 KB Output is correct
58 Correct 11 ms 604 KB Output is correct
59 Correct 11 ms 604 KB Output is correct
60 Correct 13 ms 604 KB Output is correct
61 Correct 12 ms 604 KB Output is correct
62 Correct 12 ms 604 KB Output is correct
63 Correct 12 ms 604 KB Output is correct
64 Correct 12 ms 604 KB Output is correct
65 Correct 12 ms 600 KB Output is correct
66 Correct 12 ms 604 KB Output is correct
67 Correct 13 ms 860 KB Output is correct
68 Correct 12 ms 604 KB Output is correct
69 Correct 13 ms 604 KB Output is correct
70 Correct 13 ms 604 KB Output is correct
71 Correct 12 ms 604 KB Output is correct
72 Correct 12 ms 604 KB Output is correct
73 Correct 12 ms 700 KB Output is correct
74 Correct 12 ms 604 KB Output is correct
75 Correct 12 ms 688 KB Output is correct
76 Correct 146 ms 6140 KB Output is correct
77 Correct 134 ms 16568 KB Output is correct
78 Correct 134 ms 16040 KB Output is correct
79 Correct 134 ms 16116 KB Output is correct
80 Correct 137 ms 16256 KB Output is correct
81 Correct 136 ms 16012 KB Output is correct
82 Correct 136 ms 16008 KB Output is correct
83 Correct 135 ms 16208 KB Output is correct
84 Correct 136 ms 16080 KB Output is correct
85 Correct 137 ms 16016 KB Output is correct
86 Correct 150 ms 16384 KB Output is correct
87 Correct 141 ms 16556 KB Output is correct
88 Correct 166 ms 16352 KB Output is correct
89 Correct 152 ms 16152 KB Output is correct
90 Correct 143 ms 16424 KB Output is correct