Submission #723346

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

using namespace std;

int N, M, D;

double compute (vector<int> &res) {
    double ans = 0;
    sort(res.begin(), res.end());

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

    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);

        cout << compute(res) << " ";
    }
    cout << endl;

    return 0;
}

Compilation message

Main.cpp: In function 'double compute(std::vector<int>&)':
Main.cpp:11:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for (int i = 0; i < res.size(); i ++)
      |                     ~~^~~~~~~~~~~~
Main.cpp:12:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |         for (int j = i + 1; j < res.size(); j ++)
      |                             ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 16 ms 212 KB Output is correct
2 Incorrect 16 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 212 KB Output is correct
2 Incorrect 16 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1544 ms 388 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1544 ms 388 KB Time limit exceeded
2 Halted 0 ms 0 KB -