답안 #890509

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
890509 2023-12-21T11:04:05 Z Iwantbemaster Parking Problem (innopolis2021_final_A) C++17
54 / 100
18 ms 928 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.emplace_back(l);
				cur += (l - 1) / 2;
			} else {
				e.emplace_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.emplace_back(x);
			} else if(!o.empty()){
				int x = o.back() - 1;
				o.pop_back(); e.emplace_back(x);
			}
		} if(cnt >= cur) cout << "N";
		else cout << "Y";
	} cout << "\n";
}
main(){
	int test; cin >> test;
	while(test--){
		solve();
	}
}

Compilation message

Main.cpp:50:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   50 | main(){
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 860 KB Output is correct
2 Correct 7 ms 696 KB Output is correct
3 Correct 15 ms 604 KB Output is correct
4 Correct 6 ms 928 KB Output is correct
5 Correct 7 ms 544 KB Output is correct
6 Correct 7 ms 876 KB Output is correct
7 Correct 7 ms 604 KB Output is correct
8 Correct 16 ms 668 KB Output is correct
9 Correct 6 ms 860 KB Output is correct
10 Correct 9 ms 604 KB Output is correct
11 Correct 18 ms 732 KB Output is correct
12 Correct 7 ms 808 KB Output is correct
13 Correct 7 ms 604 KB Output is correct
14 Correct 17 ms 676 KB Output is correct
15 Correct 14 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 860 KB Output is correct
2 Correct 9 ms 604 KB Output is correct
3 Correct 16 ms 776 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 7 ms 604 KB Output is correct
8 Incorrect 17 ms 684 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 804 KB Output is correct
2 Correct 7 ms 600 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 604 KB Output is correct
6 Correct 12 ms 728 KB Output is correct
7 Correct 14 ms 760 KB Output is correct
8 Correct 17 ms 604 KB Output is correct
9 Correct 15 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 860 KB Output is correct
2 Correct 7 ms 696 KB Output is correct
3 Correct 15 ms 604 KB Output is correct
4 Correct 6 ms 928 KB Output is correct
5 Correct 7 ms 544 KB Output is correct
6 Correct 7 ms 876 KB Output is correct
7 Correct 7 ms 604 KB Output is correct
8 Correct 16 ms 668 KB Output is correct
9 Correct 6 ms 860 KB Output is correct
10 Correct 9 ms 604 KB Output is correct
11 Correct 18 ms 732 KB Output is correct
12 Correct 7 ms 808 KB Output is correct
13 Correct 7 ms 604 KB Output is correct
14 Correct 17 ms 676 KB Output is correct
15 Correct 14 ms 604 KB Output is correct
16 Correct 6 ms 860 KB Output is correct
17 Correct 9 ms 604 KB Output is correct
18 Correct 16 ms 776 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 7 ms 604 KB Output is correct
23 Incorrect 17 ms 684 KB Output isn't correct
24 Halted 0 ms 0 KB -