Submission #793328

# Submission time Handle Problem Language Result Execution time Memory
793328 2023-07-25T17:53:45 Z rainboy Parking Problem (innopolis2021_final_A) C
100 / 100
11 ms 1584 KB
#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

Main.c: In function 'main':
Main.c:11:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf("%d", &t);
      |  ^~~~~~~~~~~~~~~
Main.c:16:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |   scanf("%s%s", aa, bb), n = strlen(aa), m = strlen(bb);
      |   ^~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1364 KB Output is correct
2 Correct 3 ms 1236 KB Output is correct
3 Correct 10 ms 1480 KB Output is correct
4 Correct 3 ms 1492 KB Output is correct
5 Correct 4 ms 1236 KB Output is correct
6 Correct 3 ms 1560 KB Output is correct
7 Correct 4 ms 1236 KB Output is correct
8 Correct 9 ms 1440 KB Output is correct
9 Correct 4 ms 1364 KB Output is correct
10 Correct 5 ms 1220 KB Output is correct
11 Correct 10 ms 1428 KB Output is correct
12 Correct 3 ms 1456 KB Output is correct
13 Correct 5 ms 1184 KB Output is correct
14 Correct 10 ms 1468 KB Output is correct
15 Correct 8 ms 1012 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1412 KB Output is correct
2 Correct 4 ms 1196 KB Output is correct
3 Correct 10 ms 1492 KB Output is correct
4 Correct 3 ms 1492 KB Output is correct
5 Correct 4 ms 1236 KB Output is correct
6 Correct 3 ms 1364 KB Output is correct
7 Correct 4 ms 1308 KB Output is correct
8 Correct 10 ms 1492 KB Output is correct
9 Correct 3 ms 1492 KB Output is correct
10 Correct 4 ms 1304 KB Output is correct
11 Correct 11 ms 1492 KB Output is correct
12 Correct 3 ms 1452 KB Output is correct
13 Correct 4 ms 1304 KB Output is correct
14 Correct 10 ms 1472 KB Output is correct
15 Correct 9 ms 984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 1364 KB Output is correct
2 Correct 4 ms 1236 KB Output is correct
3 Correct 4 ms 1236 KB Output is correct
4 Correct 5 ms 1220 KB Output is correct
5 Correct 6 ms 1236 KB Output is correct
6 Correct 8 ms 1384 KB Output is correct
7 Correct 9 ms 1320 KB Output is correct
8 Correct 11 ms 1432 KB Output is correct
9 Correct 9 ms 980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1364 KB Output is correct
2 Correct 3 ms 1236 KB Output is correct
3 Correct 10 ms 1480 KB Output is correct
4 Correct 3 ms 1492 KB Output is correct
5 Correct 4 ms 1236 KB Output is correct
6 Correct 3 ms 1560 KB Output is correct
7 Correct 4 ms 1236 KB Output is correct
8 Correct 9 ms 1440 KB Output is correct
9 Correct 4 ms 1364 KB Output is correct
10 Correct 5 ms 1220 KB Output is correct
11 Correct 10 ms 1428 KB Output is correct
12 Correct 3 ms 1456 KB Output is correct
13 Correct 5 ms 1184 KB Output is correct
14 Correct 10 ms 1468 KB Output is correct
15 Correct 8 ms 1012 KB Output is correct
16 Correct 3 ms 1412 KB Output is correct
17 Correct 4 ms 1196 KB Output is correct
18 Correct 10 ms 1492 KB Output is correct
19 Correct 3 ms 1492 KB Output is correct
20 Correct 4 ms 1236 KB Output is correct
21 Correct 3 ms 1364 KB Output is correct
22 Correct 4 ms 1308 KB Output is correct
23 Correct 10 ms 1492 KB Output is correct
24 Correct 3 ms 1492 KB Output is correct
25 Correct 4 ms 1304 KB Output is correct
26 Correct 11 ms 1492 KB Output is correct
27 Correct 3 ms 1452 KB Output is correct
28 Correct 4 ms 1304 KB Output is correct
29 Correct 10 ms 1472 KB Output is correct
30 Correct 9 ms 984 KB Output is correct
31 Correct 4 ms 1364 KB Output is correct
32 Correct 4 ms 1236 KB Output is correct
33 Correct 4 ms 1236 KB Output is correct
34 Correct 5 ms 1220 KB Output is correct
35 Correct 6 ms 1236 KB Output is correct
36 Correct 8 ms 1384 KB Output is correct
37 Correct 9 ms 1320 KB Output is correct
38 Correct 11 ms 1432 KB Output is correct
39 Correct 9 ms 980 KB Output is correct
40 Correct 0 ms 212 KB Output is correct
41 Correct 0 ms 212 KB Output is correct
42 Correct 0 ms 212 KB Output is correct
43 Correct 1 ms 468 KB Output is correct
44 Correct 1 ms 340 KB Output is correct
45 Correct 1 ms 340 KB Output is correct
46 Correct 9 ms 1064 KB Output is correct
47 Correct 4 ms 1584 KB Output is correct
48 Correct 4 ms 1392 KB Output is correct
49 Correct 3 ms 1364 KB Output is correct