# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1129247 | mnbvcxz123 | Parking Problem (innopolis2021_final_A) | C++20 | 11 ms | 840 KiB |
#include <stdio.h>
#include <string.h>
#define N 500000
int min(int a, int b) { return a < b ? a : b; }
int main() {
int t;
scanf("%d", &t);
while (t--) {
static char aa[N + 1], bb[N + 1], cc[N + 2];
int n, m, i, j, k, a, b, c, x, y;
scanf("%s%s", aa, bb), n = strlen(aa), m = strlen(bb);
a = 0, b = 0, c = 0;
for (i = 0; i < n; i++)
if (aa[i] == '.') {
j = i + 1;
while (j < n && aa[j] == '.')
j++;
k = j - i;
a += k / 2;
if (k > 2) {
if (k % 2 == 0)
b++, k -= 3;
c += k / 6;
}
i = j;
}
memset(cc, 'N', (m + 1) * sizeof *cc), cc[m + 1] = 0;
x = y = 0;
for (j = 0; j <= m; j++) {
if (x + y + (x <= b ? x : b + min((x - b) / 2, c)) >= a)
break;
cc[j] = 'Y';
if (j < m) {
if (bb[j] == 'C')
x++;
else
y++;
}
}
printf("%s\n", cc);
}
return 0;
}
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... |