Submission #1208910

#TimeUsernameProblemLanguageResultExecution timeMemory
1208910ezzzayBliskost (COI23_bliskost)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define int long long
const int N=2e6+5;
const int P=1e9+7;
int bit[N];
void update(int idx, int val){
    while(idx<N){
        bit[idx]+=val;
        idx+= idx & -idx;
    }
}
int find(int idx){
    int s=0;
    while(idx>0){
        s+=bit[idx];
        idx-= idx & -idx;
    }
    return s;
}
signed main(){
    int n,q;
    cin>>n>>q;
    string s,t;
    cin>>s>>t;
    for(int i=1;i<=n;i++){
        int c= (t[i-1]-s[i-1]+26)%26;
        if(n%2== i%2){
            update(i,c);
        }
        else{
            update(i,-c);
        }
    }
    if((find(n-1)%26+260+(t[n-1]-s[n-1]+26)%26)%26==0){
        cout<<"da"<<endl;
    }
    else{
        cout<<"ne"<<endl;;
    }
    
    while(q--){
        int i;
        char p;
        cin>>i>>p;
        int c= (t[i-1]-s[i-1]+26)%26;
        if(n%2== i%2){
            update(i,-c);
        }
        else{
            update(i,+c);
        }
        
        s[i-1]=p;

        int c= (t[i-1]-s[i-1]+26)%26;
        if(n%2== i%2){
            update(i,c);
        }
        else{
            update(i,-c);
        }
        if((find(n-1)%26+260+(t[n-1]-s[n-1]+26)%26)%26==0){
            cout<<"da"<<'\n';
        }
        else{
            cout<<"ne"<<'\n';
        }
    }
    
}

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:59:13: error: redeclaration of 'long long int c'
   59 |         int c= (t[i-1]-s[i-1]+26)%26;
      |             ^
Main.cpp:49:13: note: 'long long int c' previously declared here
   49 |         int c= (t[i-1]-s[i-1]+26)%26;
      |             ^