Submission #1019241

# Submission time Handle Problem Language Result Execution time Memory
1019241 2024-07-10T16:06:39 Z MarwenElarbi Bliskost (COI23_bliskost) C++17
0 / 100
2 ms 604 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")<<endl;
    for (int i = 0; i < q; ++i)
    {
        int x;
        char y;
        cin>>x>>y;
        x--;
        a[x]=y;
        tab[x]=(-(i ? tab[x-1] : 0)+b[x]-a[x]+26)%26;
        for (int j = x+1; j < n; ++j)
        {
            tab[j]=(b[j]-a[j]-tab[j-1]+26)%26;
            //cout <<tab[j]<<" ";
        }//cout <<endl;
        cout << (tab[n-1]==0 ? "da" : "ne")<<endl;
    }
}

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 Runtime error 2 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -