답안 #619316

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
619316 2022-08-02T11:06:32 Z drdilyor 조교 (CEOI16_popeala) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#ifdef ONPC
    #include "t_debug.cpp"
#else
    #define debug(...) 42
#endif
#define sz(a) ((int)(a).size())
using namespace std;
using ll = long long;
const int INF = 1e9;
const ll INFL = 1e18;
const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937 rng(RANDOM);
template<typename T, typename U> istream& operator>>(istream& is, pair<T, U>& p) { return is >> p.first >> p.second; }
const int N = 2e4, LOGN = 17, K = 50, MOD = 1e9+7;

int solve() {
    int n, t, s;
    cin >> n >> t >> s;
    if (!cin) return 1;

    vector<int> pts(t);
    for (auto& i : pts) {cin >> i;}
    vector<string> res(n);
    for (auto& i : res) {cin >> i;}

    int memo[n][t];
    memset(memo, -1, sizeof(memo));
    function<int(int,int)> dp = [&](int i, int g) {
        if (i == t) return g ? INF : 0;
        if (i > t) return INF;
        if (!g) return INF;
        if (memo[i][g] != -1) return memo[i][g];

        int mn = INF;
        ll fail = 0;
        int score = 0;
        for (int j = i; j < t; j++) {
            score += pts[j];
            for (int c = 0; c < n; c++) {
                fail |= (res[c][j] == '0') << c;
            }
            int count = n - __builtin_popcount(fail);
            mn = min(mn, count * score + dp(j+1, g-1));
        }
        return memo[i][g] = mn;
    };
    for (int k = 1; k <= t; k++) {
        cout << dp(0, k) << '\n';
    }
    
    return 0;
}

signed main() {
    cin.tie(0)->sync_with_stdio(0);
    int t = 1;
    #ifdef ONPC
    t = 10000;
    #endif
    while (t-- && cin) {
        if (solve()) break;
        #ifdef ONPC
            cout << "____________________" << endl;
        #endif
    }
    return 0;
}

/*
     █████               █████  ███  ████                               
    ▒▒███               ▒▒███  ▒▒▒  ▒▒███                               
  ███████  ████████   ███████  ████  ▒███  █████ ████  ██████  ████████ 
 ███▒▒███ ▒▒███▒▒███ ███▒▒███ ▒▒███  ▒███ ▒▒███ ▒███  ███▒▒███▒▒███▒▒███
▒███ ▒███  ▒███ ▒▒▒ ▒███ ▒███  ▒███  ▒███  ▒███ ▒███ ▒███ ▒███ ▒███ ▒▒▒ 
▒███ ▒███  ▒███     ▒███ ▒███  ▒███  ▒███  ▒███ ▒███ ▒███ ▒███ ▒███     
▒▒████████ █████    ▒▒████████ █████ █████ ▒▒███████ ▒▒██████  █████    
 ▒▒▒▒▒▒▒▒ ▒▒▒▒▒      ▒▒▒▒▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒   ▒▒▒▒▒███  ▒▒▒▒▒▒  ▒▒▒▒▒     
                                            ███ ▒███                    
                                           ▒▒██████                     
                                            ▒▒▒▒▒▒
*/

Compilation message

popeala.cpp: In lambda function:
popeala.cpp:33:13: sorry, unimplemented: capture of variably-modified type 'int [n][t]' that is not an N3639 array of runtime bound
   33 |         if (memo[i][g] != -1) return memo[i][g];
      |             ^~~~
popeala.cpp:33:13: note: because the array element type 'int [t]' has variable size
popeala.cpp:33:38: sorry, unimplemented: capture of variably-modified type 'int [n][t]' that is not an N3639 array of runtime bound
   33 |         if (memo[i][g] != -1) return memo[i][g];
      |                                      ^~~~
popeala.cpp:33:38: note: because the array element type 'int [t]' has variable size
popeala.cpp:46:16: sorry, unimplemented: capture of variably-modified type 'int [n][t]' that is not an N3639 array of runtime bound
   46 |         return memo[i][g] = mn;
      |                ^~~~
popeala.cpp:46:16: note: because the array element type 'int [t]' has variable size