답안 #265473

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
265473 2020-08-14T21:47:33 Z kimbj0709 조교 (CEOI16_popeala) C++14
0 / 100
38 ms 1536 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);
    }
    for(int i=0;i<=t;i++){
      for(int j=0;j<=n;j++){
        //cout << last[i][j] << " ";
      }
      //cout << endl;
    }
    vector<int> dp(maxn,0);
    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;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 640 KB Output is correct
2 Incorrect 1 ms 640 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 896 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 38 ms 1536 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 640 KB Output is correct
2 Incorrect 1 ms 640 KB Output isn't correct