Submission #14409

#TimeUsernameProblemLanguageResultExecution timeMemory
14409dodo3371볼질 (OJUZ10_ballparade)C++14
0 / 100
29 ms1720 KiB
#include<stdio.h> #include<iostream> #include<cstring> #include<algorithm> #include<vector> #include<string> #include<iomanip> #include<functional> #include<stack> #include<set> #include<map> #include<queue> using namespace std; int n; int ballCnt; bool isBase[3]; int res = 0; int sol(int pos) { if (pos >= 3) return 1; if (!isBase[pos]) { isBase[pos] = true; return 0; } int ret = 0; if (isBase[pos]) res += sol(pos + 1); return ret; } int main() { #ifdef _CONSOLE freopen("input.txt", "r", stdin); #endif ////////////////////////////////////////////////// scanf("%d", &n); while (n--) { int point; scanf("%d", &point); if (point == 1) { ballCnt++; if (ballCnt == 4) { res += sol(0); ballCnt = 0; } } else if (point == 2) { res += sol(0); ballCnt = 0; } else { ballCnt++; if (isBase[2]) { res++; isBase[2] = false; } for (int i = 1; i >= 0; i--) { if (isBase[i]) { isBase[i + 1] = true; isBase[i] = false; } } if (ballCnt == 4) { isBase[0] = true; ballCnt = 0; } } printf("%d %d %d %d\n", isBase[2], isBase[1], isBase[0], res); } printf("%d\n", res); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...