Submission #966748

#TimeUsernameProblemLanguageResultExecution timeMemory
966748CookieBliskost (COI23_bliskost)C++14
7 / 100
12 ms3160 KiB
#include<bits/stdc++.h> #include<fstream> using namespace std; #define sz(a) (int)a.size() #define ALL(v) v.begin(), v.end() #define ALLR(v) v.rbegin(), v.rend() #define ll long long #define pb push_back #define forr(i, a, b) for(int i = a; i < b; i++) #define dorr(i, a, b) for(int i = a; i >= b; i--) #define ld long double #define vt vector #include<fstream> #define fi first #define se second #define pll pair<ll, ll> #define pii pair<int, int> #define mpp make_pair #define ull unsigned long long const ld PI = 3.14159265359, prec = 1e-9;; //using u128 = __uint128_t; //const int x[4] = {1, 0, -1, 0}; //const int y[4] = {0, -1, 0, 1}; const ll mod = 1e9 + 19972207, pr = 31; const int mxn = 5e5 + 5, mxq = 1e5 + 5, sq = 500, mxv = 10005; //const int base = (1 <<18); const ll inf = 1e9 + 5, neg = -69420, inf2 = 1e14; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); // have fun! int n, q; string s, t; int a[mxn + 1], b[mxn + 1]; void calc(){ int rem = 0, have = 0; for(int i = 1; i < n; i++){ int need = ((b[i] - a[i]) - have + 26) % 26; have = need; } if((b[n] - a[n] + 26) % 26 == have){ cout << "da" << "\n"; }else{ cout << "ne" << "\n"; } } void solve(){ cin >> n >> q; string s, t; cin >> s >> t; for(int i = 1; i <= n; i++)a[i] = (s[i - 1] - 'a'); for(int i = 1; i <= n; i++)b[i] = (t[i - 1] - 'a'); calc(); while(q--){ int id; char c; cin >> id >> c; a[id] = (c - 'a'); calc(); } } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); //freopen("i.inp", "r", stdin); //freopen("i.out", "w", stdout); int tt; tt = 1; while(tt--){ solve(); } return(0); }

Compilation message (stderr)

Main.cpp: In function 'void calc()':
Main.cpp:34:9: warning: unused variable 'rem' [-Wunused-variable]
   34 |     int rem = 0, have = 0;
      |         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...