제출 #538958

#제출 시각아이디문제언어결과실행 시간메모리
538958ryangohca조교 (CEOI16_popeala)C++17
17 / 100
2081 ms2260 KiB
#include <bits/stdc++.h>
#define int long long
#define pii pair<int, int>
#define ti3 tuple<int, int, int>
#define ti4 tuple<int, int, int, int>
// This is like my secret account; yes it's like that  ~ Baek Jiheon, Feel Good (Secret Code)
using namespace std;
int psum[20001];
int psumt[51][20001];
int n;
string results[51];
int cost(int l, int r){
    int score = psum[r] - psum[l-1];
    int ans = 0;
    for (int i = 0; i < n; i++){
        if (psumt[i][r] - psumt[i][l-1] == r-l+1) ans += score;
    }
    return ans;
}
int dp[20001][51];
main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int t, s; cin >> n >> t >> s;
    for (int i = 1; i <= t; i++){
        cin >> psum[i];
        psum[i] += psum[i-1];
    }
    for (int i = 0; i < n; i++){
        for (int j = 1; j <= t; j++){
            char x; cin >> x;
            int g = x - '0';
            psumt[i][j] = g;
            psumt[i][j] += psumt[i][j-1];
        }
    }
    dp[0][0] = 0;
    for (int i = 1; i <= t; i++){
        dp[i][0] = 1e15;
    }
    for (int i = 1; i <= s; i++){
        dp[0][i] = 1e15;
        for (int j = 1; j <= t; j++){
            dp[j][i] = 1e15;
            for (int k = 0; k < j; k++){
                dp[j][i] = min(dp[j][i], dp[k][i-1] + cost(k+1, j));
            }
        }
        cout << dp[t][i] << '\n';
    }
}

컴파일 시 표준 에러 (stderr) 메시지

popeala.cpp:21:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   21 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...