#include <bits/stdc++.h>
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
using namespace std;
#define int long long
#define nl '\n'
#define pb push_back
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n , q;
cin>>n>>q;
string s , t;
cin>>s>>t;
s = '.' + s;
t = '.' + t;
vector<int> a(n);
a[0] = 0;
for(int i = 1 ; i <= n - 1 ; i++)
{
a[i] = (t[i] - s[i] - a[i - 1] + 2 * 26)%26;
}
if(a[n - 1] == (t[n] - s[n] + 26)%26)
cout<<"da"<<nl;
else
cout<<"ne"<<nl;
// while(q--)
// {
// int i;
// char c;
// cin>>i>>c;
// int diff = (s[i] - c + 26)%26;
// s[i] = c;
// for(int j = i ; j <= n - 1 ; j++)
// {
// if((j - i)%2 == 0)
// {
// a[j] = (a[j] + diff)%26;
// }
// else
// {
// a[j] = (a[j] - diff + 26)%26;
// }
// }
// if(a[n - 1] == (t[n] - s[n] + 26)%26)
// cout<<"da"<<nl;
// else
// cout<<"ne"<<nl;
// }
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |