Submission #890512

# Submission time Handle Problem Language Result Execution time Memory
890512 2023-12-21T11:09:36 Z Iwantbemaster Parking Problem (innopolis2021_final_A) C++17
54 / 100
19 ms 924 KB
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
const unsigned long long ForSpeed = [](){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	return 0;
}();
void solve(){
	string str; cin >> str;
	unsigned long long m = (unsigned long long)str.size();
	string strw; cin >> strw;
	unsigned long long n = (unsigned long long)strw.size();
	vector<unsigned long long> e, o;
	unsigned long long cur = 0;
	for(unsigned long long i = 0; i < m;){
		if(str[i] == 'X'){
			i++; continue;
		} unsigned long long j = i;
		while(j < m && str[j] == '.') j++;
		unsigned long long 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;
	} unsigned long long cnt = 0;
	if(cnt >= cur) cout << "N";
	else cout << "Y";
	for(unsigned long long i = 0; i < n; i++){ cnt++;
		if(strw[i] == 'C'){
			if(!e.empty()){
				unsigned long long x = e.back() - 1;
				cur--; e.pop_back();
				if(x > 5){ o.push_back(x); }
			} else if(!o.empty()){
				unsigned long long x = o.back() - 1;
				o.pop_back(); e.push_back(x);
			}
		} if(cnt >= cur) cout << "N";
		else cout << "Y";
	} cout << "\n";
}
main(){
	unsigned long long test; cin >> test;
	while(test--){
		solve();
	}
}

Compilation message

Main.cpp:49:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   49 | main(){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 856 KB Output is correct
2 Correct 6 ms 604 KB Output is correct
3 Correct 15 ms 600 KB Output is correct
4 Correct 6 ms 924 KB Output is correct
5 Correct 6 ms 604 KB Output is correct
6 Correct 7 ms 876 KB Output is correct
7 Correct 7 ms 600 KB Output is correct
8 Correct 16 ms 604 KB Output is correct
9 Correct 6 ms 856 KB Output is correct
10 Correct 8 ms 644 KB Output is correct
11 Correct 18 ms 632 KB Output is correct
12 Correct 6 ms 808 KB Output is correct
13 Correct 7 ms 604 KB Output is correct
14 Correct 17 ms 604 KB Output is correct
15 Correct 14 ms 856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 856 KB Output is correct
2 Correct 7 ms 600 KB Output is correct
3 Correct 16 ms 600 KB Output is correct
4 Correct 6 ms 816 KB Output is correct
5 Correct 7 ms 724 KB Output is correct
6 Correct 5 ms 860 KB Output is correct
7 Correct 7 ms 636 KB Output is correct
8 Incorrect 19 ms 860 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 804 KB Output is correct
2 Correct 7 ms 604 KB Output is correct
3 Correct 7 ms 604 KB Output is correct
4 Correct 8 ms 604 KB Output is correct
5 Correct 10 ms 600 KB Output is correct
6 Correct 12 ms 604 KB Output is correct
7 Correct 16 ms 752 KB Output is correct
8 Correct 17 ms 600 KB Output is correct
9 Correct 13 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 856 KB Output is correct
2 Correct 6 ms 604 KB Output is correct
3 Correct 15 ms 600 KB Output is correct
4 Correct 6 ms 924 KB Output is correct
5 Correct 6 ms 604 KB Output is correct
6 Correct 7 ms 876 KB Output is correct
7 Correct 7 ms 600 KB Output is correct
8 Correct 16 ms 604 KB Output is correct
9 Correct 6 ms 856 KB Output is correct
10 Correct 8 ms 644 KB Output is correct
11 Correct 18 ms 632 KB Output is correct
12 Correct 6 ms 808 KB Output is correct
13 Correct 7 ms 604 KB Output is correct
14 Correct 17 ms 604 KB Output is correct
15 Correct 14 ms 856 KB Output is correct
16 Correct 5 ms 856 KB Output is correct
17 Correct 7 ms 600 KB Output is correct
18 Correct 16 ms 600 KB Output is correct
19 Correct 6 ms 816 KB Output is correct
20 Correct 7 ms 724 KB Output is correct
21 Correct 5 ms 860 KB Output is correct
22 Correct 7 ms 636 KB Output is correct
23 Incorrect 19 ms 860 KB Output isn't correct
24 Halted 0 ms 0 KB -