Submission #314996

#TimeUsernameProblemLanguageResultExecution timeMemory
314996FlashGamezzzVođe (COCI17_vode)C++17
120 / 120
871 ms120560 KiB
#include <iostream> #include <cstdlib> #include <cstdio> #include <fstream> #include <algorithm> #include <string> using namespace std; int n, m, k, nt[5000][5001]; bool sg[5000], dp[5000][5000]; //n, m int main() { ios_base::sync_with_stdio(false); cin >> n >> m >> k; for (int i = 0; i < n; i++){ cin >> sg[i]; } for (int i = 0; i < n; i++){ dp[i][m-1] = !sg[i]; nt[i][m] = 0; nt[i][m-1] = !sg[i]; } for (int i = m-2; i >= 0; i--){ for (int j = 0; j < n; j++){ int is = i+1, ie = min(m, i+k+1), il = ie-is, nv = (j+1) % n, itn = nt[nv][is]-nt[nv][ie]; if (sg[j]){ dp[j][i] = true; if (itn == 0){ dp[j][i] = false; } } else { dp[j][i] = false; if (itn == il){ dp[j][i] = true; } } nt[j][i] = nt[j][i+1]+dp[j][i]; } } for (int i = 0; i < n; i++){ cout << dp[i][0] << " "; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...