Submission #723359

# Submission time Handle Problem Language Result Execution time Memory
723359 2023-04-13T16:06:46 Z t_holl Measures (CEOI22_measures) C++14
0 / 100
1500 ms 428 KB
#include <bits/stdc++.h>

using namespace std;

int N, M, D;

int compute (vector<int> &res) {
    int ans = 0;

    for (int i = 0; i < res.size(); i ++)
        for (int j = i; j < res.size(); j ++)
            ans = max(ans, D * (j - i) - (res[j] - res[i]));

    return ans;
}

int main() {
    cin >> N >> M >> D;

    vector<int> res;
    for (int i = 0; i < N; i ++) {
        int x; cin >> x;
        res.push_back(x);
    }
    for (int i = 0; i < M; i ++) {
        int x; cin >> x;
        res.push_back(x);

        sort(res.begin(), res.end());
        int total = compute(res);
        cout << (total >> 1);
        if (total % 2 == 1) cout << ".5";

        cout << " ";
    }

    return 0;
}

Compilation message

Main.cpp: In function 'int compute(std::vector<int>&)':
Main.cpp:10:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     for (int i = 0; i < res.size(); i ++)
      |                     ~~^~~~~~~~~~~~
Main.cpp:11:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |         for (int j = i; j < res.size(); j ++)
      |                         ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 24 ms 212 KB Output is correct
2 Correct 25 ms 212 KB Output is correct
3 Correct 26 ms 212 KB Output is correct
4 Correct 27 ms 212 KB Output is correct
5 Correct 26 ms 212 KB Output is correct
6 Correct 28 ms 308 KB Output is correct
7 Correct 23 ms 212 KB Output is correct
8 Incorrect 25 ms 212 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 24 ms 212 KB Output is correct
2 Correct 25 ms 212 KB Output is correct
3 Correct 26 ms 212 KB Output is correct
4 Correct 27 ms 212 KB Output is correct
5 Correct 26 ms 212 KB Output is correct
6 Correct 28 ms 308 KB Output is correct
7 Correct 23 ms 212 KB Output is correct
8 Incorrect 25 ms 212 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1572 ms 428 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1572 ms 428 KB Time limit exceeded
2 Halted 0 ms 0 KB -