Submission #1112523

# Submission time Handle Problem Language Result Execution time Memory
1112523 2024-11-14T09:27:49 Z vjudge1 Bliskost (COI23_bliskost) C++17
0 / 100
1 ms 336 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define pb push_back
#define F first
#define S second
#define all(v) v.begin(),v.end()


typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<int,int> mii;
const int INF = 2e5 + 100;

int n,q;
string a,b;



int32_t main(){		
	cin >> n >> q >> a >> b;
	vi differ;
	for (int i = 0; i < n; i++){
		int step = 0;
		char x = a[i];
		while (x != b[i]){
			step++; x++;
			if (x > 'z') x = 'a';
		}
	//	int tmp = b[i] - a[i];
	//	if (tmp < 0) tmp += 26;
		differ.pb(min(step,26 - step));
		//cout << step << " ";
	}

	bool c = true;
	for (int i = 0; i < n-1; i++){
		if (differ[i] > differ[i+1]){
			c = false;
			break;
		}
		else {
			differ[i+1] -= differ[i];
			differ[i] = 0;
		}
	}

	if (c) cout << "da" << endl;
	else cout << "ne" << endl;
	
	return 0;
}	
# 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 Incorrect 1 ms 336 KB Output isn't correct
4 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 Incorrect 1 ms 336 KB Output isn't correct
4 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 Incorrect 1 ms 336 KB Output isn't correct
4 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 Incorrect 1 ms 336 KB Output isn't correct
4 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 Incorrect 1 ms 336 KB Output isn't correct
4 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 Incorrect 1 ms 336 KB Output isn't correct
4 Halted 0 ms 0 KB -