Submission #871283

# Submission time Handle Problem Language Result Execution time Memory
871283 2023-11-10T12:11:13 Z edogawa_something Bliskost (COI23_bliskost) C++17
57 / 100
1000 ms 5876 KB
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef vector<ll> vii;
typedef pair<ll,ll> pii;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define F first 
#define S second 
#define pb push_back
#define all(v) v.begin(),v.end()
#define pow poww
const ll M=500000;
const ll mod=998244353;
const ll inf=2e18;
ll pow(ll x,ll y){
  ll res=1;
  while(y>0){
    if((y&1))
    res*=x,res%=mod;
    x*=x,x%=mod;
    y=(y>>1);
  }
  return res;
}
string s,t;
int n,q;
bool x=0;
void p(char &c,int x){
  c+=x;
  if(c>'z'||c<'a')
  c-=26;
}
int main(){
  ios_base::sync_with_stdio(0),cin.tie(0);
  ll TC=1;
  //cin>>TC;
  while(TC--){
    cin>>n>>q>>s>>t;
    string ss=s;
    for(int i=0;i<n-1;i++){
      while(t[i]!='a')
      p(t[i],1),p(t[i+1],1);
    }
    for(int i=0;i<n-1;i++){
      p(ss[i+1],(26-(ss[i]-'a'))%26),p(ss[i],(26-(ss[i]-'a'))%26);
    }
    if(ss.back()==t.back())
    cout<<"da\n";
    else
    cout<<"ne\n";
    while(q--){
      int ind;
      char c;
      cin>>ind>>c;
      ind--;
      s[ind]=c;
      ss=s; 
      for(int i=0;i<n-1;i++){
        p(ss[i+1],(26-ss[i]+'a')%26),p(ss[i],(26-ss[i]+'a')%26);
      }
      if(ss.back()==t.back())
      cout<<"da\n";
      else
      cout<<"ne\n";
    }
  }
  return 0;
}
/*

*/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 600 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 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 456 KB Output is correct
13 Correct 0 ms 456 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 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 600 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 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 456 KB Output is correct
13 Correct 0 ms 456 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 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 460 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 1 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 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 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 600 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 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 456 KB Output is correct
13 Correct 0 ms 456 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 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 460 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 1 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 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 60 ms 5396 KB Output is correct
32 Correct 60 ms 5260 KB Output is correct
33 Correct 61 ms 5476 KB Output is correct
34 Correct 61 ms 5704 KB Output is correct
35 Correct 60 ms 5476 KB Output is correct
36 Correct 60 ms 5876 KB Output is correct
37 Correct 60 ms 5620 KB Output is correct
38 Correct 61 ms 5532 KB Output is correct
39 Correct 60 ms 5624 KB Output is correct
40 Correct 62 ms 5868 KB Output is correct
41 Correct 60 ms 5264 KB Output is correct
42 Correct 60 ms 5260 KB Output is correct
43 Correct 61 ms 5852 KB Output is correct
44 Correct 60 ms 5480 KB Output is correct
45 Correct 60 ms 5472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 600 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 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 456 KB Output is correct
13 Correct 0 ms 456 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 11 ms 1108 KB Output is correct
17 Correct 11 ms 1116 KB Output is correct
18 Correct 12 ms 1116 KB Output is correct
19 Correct 10 ms 1116 KB Output is correct
20 Correct 11 ms 1116 KB Output is correct
21 Correct 12 ms 1116 KB Output is correct
22 Correct 11 ms 1116 KB Output is correct
23 Correct 11 ms 956 KB Output is correct
24 Correct 11 ms 1116 KB Output is correct
25 Correct 11 ms 1116 KB Output is correct
26 Correct 11 ms 1116 KB Output is correct
27 Correct 11 ms 1116 KB Output is correct
28 Correct 11 ms 1116 KB Output is correct
29 Correct 11 ms 1116 KB Output is correct
30 Correct 11 ms 1100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 600 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 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 456 KB Output is correct
13 Correct 0 ms 456 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 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 460 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 1 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 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 11 ms 1108 KB Output is correct
32 Correct 11 ms 1116 KB Output is correct
33 Correct 12 ms 1116 KB Output is correct
34 Correct 10 ms 1116 KB Output is correct
35 Correct 11 ms 1116 KB Output is correct
36 Correct 12 ms 1116 KB Output is correct
37 Correct 11 ms 1116 KB Output is correct
38 Correct 11 ms 956 KB Output is correct
39 Correct 11 ms 1116 KB Output is correct
40 Correct 11 ms 1116 KB Output is correct
41 Correct 11 ms 1116 KB Output is correct
42 Correct 11 ms 1116 KB Output is correct
43 Correct 11 ms 1116 KB Output is correct
44 Correct 11 ms 1116 KB Output is correct
45 Correct 11 ms 1100 KB Output is correct
46 Correct 720 ms 1300 KB Output is correct
47 Correct 710 ms 1220 KB Output is correct
48 Correct 697 ms 1512 KB Output is correct
49 Correct 699 ms 1364 KB Output is correct
50 Correct 724 ms 1228 KB Output is correct
51 Correct 703 ms 1364 KB Output is correct
52 Correct 718 ms 1364 KB Output is correct
53 Correct 690 ms 1100 KB Output is correct
54 Correct 710 ms 1304 KB Output is correct
55 Correct 696 ms 1344 KB Output is correct
56 Correct 693 ms 1396 KB Output is correct
57 Correct 705 ms 1384 KB Output is correct
58 Correct 703 ms 1364 KB Output is correct
59 Correct 716 ms 1108 KB Output is correct
60 Correct 709 ms 1108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 600 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 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 456 KB Output is correct
13 Correct 0 ms 456 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 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 460 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 1 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 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 60 ms 5396 KB Output is correct
32 Correct 60 ms 5260 KB Output is correct
33 Correct 61 ms 5476 KB Output is correct
34 Correct 61 ms 5704 KB Output is correct
35 Correct 60 ms 5476 KB Output is correct
36 Correct 60 ms 5876 KB Output is correct
37 Correct 60 ms 5620 KB Output is correct
38 Correct 61 ms 5532 KB Output is correct
39 Correct 60 ms 5624 KB Output is correct
40 Correct 62 ms 5868 KB Output is correct
41 Correct 60 ms 5264 KB Output is correct
42 Correct 60 ms 5260 KB Output is correct
43 Correct 61 ms 5852 KB Output is correct
44 Correct 60 ms 5480 KB Output is correct
45 Correct 60 ms 5472 KB Output is correct
46 Correct 11 ms 1108 KB Output is correct
47 Correct 11 ms 1116 KB Output is correct
48 Correct 12 ms 1116 KB Output is correct
49 Correct 10 ms 1116 KB Output is correct
50 Correct 11 ms 1116 KB Output is correct
51 Correct 12 ms 1116 KB Output is correct
52 Correct 11 ms 1116 KB Output is correct
53 Correct 11 ms 956 KB Output is correct
54 Correct 11 ms 1116 KB Output is correct
55 Correct 11 ms 1116 KB Output is correct
56 Correct 11 ms 1116 KB Output is correct
57 Correct 11 ms 1116 KB Output is correct
58 Correct 11 ms 1116 KB Output is correct
59 Correct 11 ms 1116 KB Output is correct
60 Correct 11 ms 1100 KB Output is correct
61 Correct 720 ms 1300 KB Output is correct
62 Correct 710 ms 1220 KB Output is correct
63 Correct 697 ms 1512 KB Output is correct
64 Correct 699 ms 1364 KB Output is correct
65 Correct 724 ms 1228 KB Output is correct
66 Correct 703 ms 1364 KB Output is correct
67 Correct 718 ms 1364 KB Output is correct
68 Correct 690 ms 1100 KB Output is correct
69 Correct 710 ms 1304 KB Output is correct
70 Correct 696 ms 1344 KB Output is correct
71 Correct 693 ms 1396 KB Output is correct
72 Correct 705 ms 1384 KB Output is correct
73 Correct 703 ms 1364 KB Output is correct
74 Correct 716 ms 1108 KB Output is correct
75 Correct 709 ms 1108 KB Output is correct
76 Execution timed out 1014 ms 5520 KB Time limit exceeded
77 Halted 0 ms 0 KB -