Submission #1129247

#TimeUsernameProblemLanguageResultExecution timeMemory
1129247mnbvcxz123Parking Problem (innopolis2021_final_A)C++20
100 / 100
11 ms840 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)

Main.cpp: In function 'int main()':
Main.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         scanf("%d", &t);
      |         ~~~~~^~~~~~~~~~
Main.cpp:16:22: warning: ignoring return value of 'int scanf(const char*, ...)' 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...