이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 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... |