# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
890512 | Iwantbemaster | Parking Problem (innopolis2021_final_A) | C++17 | 19 ms | 924 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |