제출 #536980

#제출 시각아이디문제언어결과실행 시간메모리
536980hmm789조교 (CEOI16_popeala)C++14
17 / 100
2085 ms852 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, t, s; cin >> n >> t >> s; int dp[s][t], pts[t], sm = 0, tmp; string score[n]; for(int i = 0; i < t; i++) cin >> pts[i]; for(int i = 0; i < n; i++) cin >> score[i]; bool died[n]; memset(died, 0, sizeof(died)); for(int i = 0; i < t; i++) { for(int j = 0; j < n; j++) if(score[j][i] == '0') died[j] = 1; dp[0][i] = 0; sm += pts[i]; for(int j = 0; j < n; j++) if(!died[j]) dp[0][i] += sm; } for(int i = 1; i < s; i++) { dp[i][i] = dp[i-1][i-1]; for(int j = 0; j < n; j++) if(score[j][i] == '1') dp[i][i] += pts[i]; } for(int i = 1; i < s; i++) { for(int j = i+1; j < t; j++) { dp[i][j] = 2e9; memset(died, 0, sizeof(died)); tmp = 0; sm = 0; for(int k = j; k >= i; k--) { for(int l = 0; l < n; l++) if(score[l][k] == '0') died[l] = 1; sm += pts[k]; tmp = 0; for(int l = 0; l < n; l++) if(!died[l]) tmp += sm; dp[i][j] = min(dp[i][j], dp[i-1][k-1] + tmp); } } } for(int i = 0; i < s; i++) cout << dp[i][t-1] << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...