Submission #265465

# Submission time Handle Problem Language Result Execution time Memory
265465 2020-08-14T21:34:15 Z kimbj0709 Popeala (CEOI16_popeala) C++14
0 / 100
38 ms 1664 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define maxn 20050
int32_t main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n,t,s;
    cin >> n >> t >> s;
    vector<int> points;
    int input1;
    char input;
    points.push_back(0);
    for(int i=0;i<t;i++){
        cin >> input1;
        points.push_back(input1);
        points[i+1] += points[i];
    }
    int last[t+5][n+1];
    memset(last,0,sizeof(last));
    for(int i=0;i<n;i++){
      for(int j=1;j<=t;j++){
        cin >> input;
        if(input=='0'){
          last[j][i] = j;
        }
        else{
          last[j][i] = last[j-1][i];
        }
      }
    }
    for(int i=0;i<=t;i++){
      last[i][n] = i;
      sort(last[i],last[i]+n+1);
    }
    vector<int> dp(maxn,INT_MAX);
    dp[0] = 0;
    for(int i=0;i<s;i++){
      vector<int> temp(maxn,INT_MAX);
      for(int j=1;j<=t;j++){
        for(int k=0;k<=n;k++){
          for(int p=last[j-1][k];p<last[j][k];p++){
            temp[j] = min(temp[j],dp[p]+(k)*(points[j]-points[p]));
          }
        }
      }
      /*for(int j=0;j<=t;j++){
        cout << temp[j] << ' ';
      }
      cout << endl;*/
      cout << temp[t] << "\n";
      dp = temp;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 640 KB Output is correct
2 Incorrect 1 ms 640 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 896 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 38 ms 1664 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 640 KB Output is correct
2 Incorrect 1 ms 640 KB Output isn't correct