Submission #1019251

# Submission time Handle Problem Language Result Execution time Memory
1019251 2024-07-10T16:11:25 Z MarwenElarbi Bliskost (COI23_bliskost) C++17
0 / 100
2 ms 344 KB
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define pb push_back
#define se second
#define fi first
#define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int nax=1e5+5;
int main() {
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    optimise;
    int n,q;
    cin>>n>>q;
    string a,b;
    cin>>a>>b;
    int tab[n];
    for (int i = 0; i < n; ++i)
    {
        int cnt = (i ? tab[i-1] : 0);
        tab[i]=(b[i]-a[i]-cnt+26)%26;
    }
    cout << (tab[n-1]==0 ? "da" : "ne")<<'\n';
    for (int i = 0; i < q; ++i)
    {
        int x;
        char y;
        cin>>x>>y;
        x--;
        int cnt=y-a[x];
        a[x]=y;
        if((n-x)%2){
            tab[n-1]-=cnt;
            tab[n-1]+=26;
            tab[n-1]%=26;
        }else{
            tab[n-1]+=cnt;
            tab[n-1]+=26;
            tab[n-1]%=26;
        }
        cout << (tab[n-1]==0 ? "da" : "ne")<<'\n';
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:12:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         freopen("input.txt", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:13:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         freopen("output.txt", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -