제출 #793328

#제출 시각아이디문제언어결과실행 시간메모리
793328rainboyParking Problem (innopolis2021_final_A)C11
100 / 100
11 ms1584 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;
}

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...