Submission #723348

# Submission time Handle Problem Language Result Execution time Memory
723348 2023-04-13T15:56:51 Z Quentolosse Measures (CEOI22_measures) C++14
0 / 100
1500 ms 496 KB
#include <bits/stdc++.h>
using namespace std;

int main() {

    ios::sync_with_stdio(false), cin.tie(0);

    int n, m, d;
    cin >> n >> m >> d;

    vector<int> points (n);

    for (int i = 0; i < n; i++)
    {
        cin >> points[i];
    }

    

    for (int i = 0; i < m; i++)
    {
        int nouveau;
        long long reponse = 0;
        cin >> nouveau;
        points.push_back(nouveau);
        sort(points.begin(), points.end());
        for (int a = 0; a < points.size(); a++)
        {
            for (int b = a+1; b < points.size(); b++)
            {
                reponse = max(reponse, (long long)((d * (b-a)) - (points[b] - points[a])));
            }
        }
        cout << (reponse - reponse % 2) / 2;
        if (reponse % 2) cout << ".5";
        cout << ' ';
    }

}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:27:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |         for (int a = 0; a < points.size(); a++)
      |                         ~~^~~~~~~~~~~~~~~
Main.cpp:29:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |             for (int b = a+1; b < points.size(); b++)
      |                               ~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 22 ms 348 KB Output is correct
2 Correct 23 ms 340 KB Output is correct
3 Correct 24 ms 340 KB Output is correct
4 Correct 23 ms 340 KB Output is correct
5 Correct 23 ms 340 KB Output is correct
6 Correct 23 ms 340 KB Output is correct
7 Correct 24 ms 340 KB Output is correct
8 Incorrect 22 ms 340 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 22 ms 348 KB Output is correct
2 Correct 23 ms 340 KB Output is correct
3 Correct 24 ms 340 KB Output is correct
4 Correct 23 ms 340 KB Output is correct
5 Correct 23 ms 340 KB Output is correct
6 Correct 23 ms 340 KB Output is correct
7 Correct 24 ms 340 KB Output is correct
8 Incorrect 22 ms 340 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1568 ms 496 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1568 ms 496 KB Time limit exceeded
2 Halted 0 ms 0 KB -