답안 #890508

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
890508 2023-12-21T11:01:15 Z Iwantbemaster Parking Problem (innopolis2021_final_A) C++17
54 / 100
19 ms 2160 KB
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
const int ForSpeed = [](){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	return 0;
}();
main(){
	long long test; cin >> test;
	while(test--){
		string str; cin >> str;
		long long m = (long long)str.size();
		string strw; cin >> strw;
		long long n = (long long)strw.size();
		vector<long long> e, o;
		long long cur = 0;
		for(long long i = 0; i < m;){
			if(str[i] == 'X'){
				i++; continue;
			} long long j = i;
			while(j < m && str[j] == '.') j++;
			long long 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;
		} long long cnt = 0;
		if(cnt >= cur) cout << "N";
		else cout << "Y";
		for(long long i = 0; i < n; i++){ cnt++;
			if(strw[i] == 'C'){
				if(!e.empty()){
					long long x = e.back() - 1;
					cur--; e.pop_back();
					if(x > 5) o.emplace_back(x);
				} else if(!o.empty()){
					long long x = o.back() - 1;
					o.pop_back(); e.emplace_back(x);
				}
			} if(cnt >= cur) cout << "N";
			else cout << "Y";
		} cout << "\n";
	}
}

Compilation message

Main.cpp:10:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   10 | main(){
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 1516 KB Output is correct
2 Correct 7 ms 1372 KB Output is correct
3 Correct 15 ms 1644 KB Output is correct
4 Correct 7 ms 1696 KB Output is correct
5 Correct 7 ms 1372 KB Output is correct
6 Correct 11 ms 2160 KB Output is correct
7 Correct 7 ms 1224 KB Output is correct
8 Correct 18 ms 1624 KB Output is correct
9 Correct 6 ms 1564 KB Output is correct
10 Correct 8 ms 1368 KB Output is correct
11 Correct 19 ms 1628 KB Output is correct
12 Correct 7 ms 1564 KB Output is correct
13 Correct 8 ms 1236 KB Output is correct
14 Correct 18 ms 1616 KB Output is correct
15 Correct 14 ms 1116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 1628 KB Output is correct
2 Correct 7 ms 1376 KB Output is correct
3 Correct 17 ms 1624 KB Output is correct
4 Correct 6 ms 1588 KB Output is correct
5 Correct 7 ms 1380 KB Output is correct
6 Correct 5 ms 1396 KB Output is correct
7 Correct 8 ms 1380 KB Output is correct
8 Incorrect 17 ms 1600 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1572 KB Output is correct
2 Correct 7 ms 1368 KB Output is correct
3 Correct 7 ms 1368 KB Output is correct
4 Correct 9 ms 1372 KB Output is correct
5 Correct 10 ms 1372 KB Output is correct
6 Correct 12 ms 1368 KB Output is correct
7 Correct 15 ms 1604 KB Output is correct
8 Correct 17 ms 1628 KB Output is correct
9 Correct 13 ms 1232 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 1516 KB Output is correct
2 Correct 7 ms 1372 KB Output is correct
3 Correct 15 ms 1644 KB Output is correct
4 Correct 7 ms 1696 KB Output is correct
5 Correct 7 ms 1372 KB Output is correct
6 Correct 11 ms 2160 KB Output is correct
7 Correct 7 ms 1224 KB Output is correct
8 Correct 18 ms 1624 KB Output is correct
9 Correct 6 ms 1564 KB Output is correct
10 Correct 8 ms 1368 KB Output is correct
11 Correct 19 ms 1628 KB Output is correct
12 Correct 7 ms 1564 KB Output is correct
13 Correct 8 ms 1236 KB Output is correct
14 Correct 18 ms 1616 KB Output is correct
15 Correct 14 ms 1116 KB Output is correct
16 Correct 6 ms 1628 KB Output is correct
17 Correct 7 ms 1376 KB Output is correct
18 Correct 17 ms 1624 KB Output is correct
19 Correct 6 ms 1588 KB Output is correct
20 Correct 7 ms 1380 KB Output is correct
21 Correct 5 ms 1396 KB Output is correct
22 Correct 8 ms 1380 KB Output is correct
23 Incorrect 17 ms 1600 KB Output isn't correct
24 Halted 0 ms 0 KB -