Submission #890511

# Submission time Handle Problem Language Result Execution time Memory
890511 2023-12-21T11:07:35 Z Iwantbemaster Parking Problem (innopolis2021_final_A) C++17
54 / 100
18 ms 1112 KB
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define ff first
#define ss second
const int ForSpeed = [](){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	return 0;
}();
void solve(){
	string str; cin >> str;
	int m = (int)str.size();
	string strw; cin >> strw;
	int n = (int)strw.size();
	vector<int> e, o;
	int cur = 0;
	for(int i = 0; i < m;){
		if(str[i] == 'X'){
			i++; continue;
		} int j = i;
		while(j < m && str[j] == '.') j++;
		int l = j - i;
		if(l >= 2){
			if(l == 2) l++;
			if(l & 1){
				if(l > 5){ o.push_back(l); }
				cur += (l - 1) / 2;
			} else {
				e.push_back(l); cur += l / 2;
			}
		} i = j;
	} int cnt = 0;
	if(cnt >= cur) cout << "N";
	else cout << "Y";
	for(int i = 0; i < n; i++){ cnt++;
		if(strw[i] == 'C'){
			if(!e.empty()){
				int x = e.back() - 1;
				cur--; e.pop_back();
				if(x > 5){ o.push_back(x); }
			} else if(!o.empty()){
				int x = o.back() - 1;
				o.pop_back(); e.push_back(x);
			}
		} if(cnt >= cur) cout << "N";
		else cout << "Y";
	} cout << "\n";
}
int main(){
	int test; cin >> test;
	while(test--){
		solve();
	}
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 856 KB Output is correct
2 Correct 7 ms 604 KB Output is correct
3 Correct 16 ms 604 KB Output is correct
4 Correct 6 ms 928 KB Output is correct
5 Correct 6 ms 604 KB Output is correct
6 Correct 7 ms 872 KB Output is correct
7 Correct 7 ms 644 KB Output is correct
8 Correct 16 ms 604 KB Output is correct
9 Correct 6 ms 860 KB Output is correct
10 Correct 8 ms 604 KB Output is correct
11 Correct 18 ms 604 KB Output is correct
12 Correct 7 ms 808 KB Output is correct
13 Correct 8 ms 600 KB Output is correct
14 Correct 18 ms 604 KB Output is correct
15 Correct 14 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1112 KB Output is correct
2 Correct 7 ms 580 KB Output is correct
3 Correct 17 ms 600 KB Output is correct
4 Correct 6 ms 816 KB Output is correct
5 Correct 7 ms 604 KB Output is correct
6 Correct 5 ms 860 KB Output is correct
7 Correct 8 ms 604 KB Output is correct
8 Incorrect 17 ms 764 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 840 KB Output is correct
2 Correct 7 ms 604 KB Output is correct
3 Correct 7 ms 604 KB Output is correct
4 Correct 9 ms 700 KB Output is correct
5 Correct 10 ms 604 KB Output is correct
6 Correct 12 ms 568 KB Output is correct
7 Correct 14 ms 604 KB Output is correct
8 Correct 17 ms 604 KB Output is correct
9 Correct 13 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 856 KB Output is correct
2 Correct 7 ms 604 KB Output is correct
3 Correct 16 ms 604 KB Output is correct
4 Correct 6 ms 928 KB Output is correct
5 Correct 6 ms 604 KB Output is correct
6 Correct 7 ms 872 KB Output is correct
7 Correct 7 ms 644 KB Output is correct
8 Correct 16 ms 604 KB Output is correct
9 Correct 6 ms 860 KB Output is correct
10 Correct 8 ms 604 KB Output is correct
11 Correct 18 ms 604 KB Output is correct
12 Correct 7 ms 808 KB Output is correct
13 Correct 8 ms 600 KB Output is correct
14 Correct 18 ms 604 KB Output is correct
15 Correct 14 ms 604 KB Output is correct
16 Correct 6 ms 1112 KB Output is correct
17 Correct 7 ms 580 KB Output is correct
18 Correct 17 ms 600 KB Output is correct
19 Correct 6 ms 816 KB Output is correct
20 Correct 7 ms 604 KB Output is correct
21 Correct 5 ms 860 KB Output is correct
22 Correct 8 ms 604 KB Output is correct
23 Incorrect 17 ms 764 KB Output isn't correct
24 Halted 0 ms 0 KB -