Submission #537039

# Submission time Handle Problem Language Result Execution time Memory
537039 2022-03-14T09:58:00 Z squiddy Popeala (CEOI16_popeala) C++14
0 / 100
9 ms 480 KB
#include <bits/stdc++.h>
#define fast_input ios_base::sync_with_stdio(0); cin.tie(0);

using namespace std;
#define ii pair<int, int>
#define iii pair<int, ii>
#define ll long long
#define ull unsigned long long
#define pq priority_queue
#define FOR(v, s, e) for (int v = s; v < e; v++)
#define FOR_REV(v, s, e) for (int v = e - 1; v >= s; v--)
#define make_ii(a, b) make_pair(a, b)
#define make_iii(a, b, c) make_pair(a, make_pair(b, c))
#define fi first
#define se second
//#define int long long

int n, t, s;
int points[505];
int results[55][505];
int table[505][55];

int32_t main() {
    fast_input;
    cin >> n >> t >> s;
    FOR(i, 1, t + 1) {
        int x;
        cin >> x;
        points[i] = x + points[i - 1];
    }
    FOR(i, 0, n) {
        string cs;
        cin >> cs;
        FOR(j, 1, t + 1) {
            results[i][j] = cs[j - 1] + results[i][j - 1] - '0';
        }
    }
    vector<int> start_pts;
    start_pts.push_back(1);
    FOR(ck, 1, s + 1) {
        FOR(i, 1, t + 1) {
            int cans = 2000000001;
            FOR(j, 0, start_pts.size()) {
                int start = start_pts[j];
                int score = 0, no_ac = 0;
                FOR(k, 0, n) {
                    no_ac += (results[k][i] - results[k][start - 1] == i - start + 1);
                }
                score = no_ac * (points[i] - points[start - 1]);
                cans = min(score + table[start][ck - 1], cans);
            }
            table[i][ck] = cans;
            if (table[i][ck - 1] < start_pts[start_pts.size() - 1]) {
                start_pts.push_back(i);
            }
        }
        start_pts.clear();
        start_pts.push_back(1);
    }
    FOR(i, 1, s + 1) {
        cout << table[t][i] << '\n';
    }
}

Compilation message

popeala.cpp: In function 'int32_t main()':
popeala.cpp:10:40: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 | #define FOR(v, s, e) for (int v = s; v < e; v++)
......
   43 |             FOR(j, 0, start_pts.size()) {
      |                 ~~~~~~~~~~~~~~~~~~~~~~  
popeala.cpp:43:13: note: in expansion of macro 'FOR'
   43 |             FOR(j, 0, start_pts.size()) {
      |             ^~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 480 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -