Submission #14594

#TimeUsernameProblemLanguageResultExecution timeMemory
14594ics0503볼질 (OJUZ10_ballparade)C++98
0 / 100
7 ms1276 KiB
#include <stdio.h> int ball[50001]; int base[5]; int main() { int n; scanf("%d", &n); int i, j; for (i = 1; i <= n; i++) scanf("%d", &ball[i]); int score = 0; int count = 0; for (i = 1; i <= n; i++) { if (ball[i] == 2) { for (j = 3; j >= 3; j--) { if (base[j] == 1) { base[j + 1] = 1; base[j] = 0; } } } if (ball[i] == 1 || ball[i] == 2) count += 1; if (count == 4) { for (j = 1; j <= 4; j++) { if (base[4] == 1) break; if (base[j] == 1) { base[j] = 2; if (base[j - 1] == 2) base[j - 1] = 1; } else { if (base[j - 1] == 2) { base[j] = 1; base[j - 1] = 1; } break; } } base[1] = 1; } else if (ball[i] == 3) { for (j = 3; j >= 1; j--) { if (base[j] == 1) { base[j + 1] = 1; base[j] = 0; } } } if (base[4] == 1) { score += 1; base[4] = 0; } } printf("%d", score); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...