Submission #1112521

# Submission time Handle Problem Language Result Execution time Memory
1112521 2024-11-14T09:25:30 Z vjudge1 Bliskost (COI23_bliskost) C++17
0 / 100
1 ms 336 KB
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define nmod(a, b) (((a%b)+b)%b) // stands for [n]atural [mod], as in "will always return a natural number", should be used in case of negative
#define a2b(a, b) (a << b) // a*2^b
#define bit(a, b) ((a >> b) & 1) // bth bit from the right, starts at zero
using namespace std;
template<class T> using vec = vector<T>;

const int INFTY = (1LL << 63) - 1;
const int NNFTY = 1LL << 63;

bool sim(string s1, string s2) {
    int n = s1.size();
    if (n != s2.size()) return false;
    int lastdiff = 0;
    for (int i = 0; i < n - 1; i++) {
        lastdiff = (s1[i] - s2[i] - lastdiff) % 26;
        if (i == n - 2 && lastdiff != (s1[n - 1] - s2[n - 1])%26) return false;
    }
    return true;
}

int32_t main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n, q; cin >> n >> q;
    string s1, s2; cin >> s1 >> s2;
    cout << "ne\n\0da\n" + 4*sim(s1, s2);
    while (q--) {
        int i; char c; cin >> i >> c; i--;
        s1[i] = c;
        cout << "ne\n\0da\n" + 4*sim(s1, s2);
    }
}

Compilation message

Main.cpp:10:31: warning: integer overflow in expression of type 'long long int' results in '9223372036854775807' [-Woverflow]
   10 | const int INFTY = (1LL << 63) - 1;
      |                   ~~~~~~~~~~~~^~~
Main.cpp: In function 'bool sim(std::string, std::string)':
Main.cpp:15:11: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     if (n != s2.size()) return false;
      |         ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Incorrect 1 ms 336 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Incorrect 1 ms 336 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Incorrect 1 ms 336 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Incorrect 1 ms 336 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Incorrect 1 ms 336 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Incorrect 1 ms 336 KB Output isn't correct
9 Halted 0 ms 0 KB -