Submission #954724

# Submission time Handle Problem Language Result Execution time Memory
954724 2024-03-28T12:37:51 Z LucaIlie Measures (CEOI22_measures) C++17
24 / 100
1500 ms 3308 KB
#include <bits/stdc++.h>

using namespace std;

vector<int> v;

int main() {
    int n, q, d;

    cin >> n >> q >> d;

    for ( int i = 0; i < n; i++ ) {
        int p;
        cin >> p;
        v.push_back( p );
    }

    for ( int i = 0; i < q; i++ ) {
        int p;
        cin >> p;

        v.push_back( p );
        sort( v.begin(), v.end() );

        long long minn = 1e9, ans = 0;
        for ( int i = 0; i < v.size(); i++ ) {
            ans = max( ans, (long long)d * i - v[i] - minn );
            minn = min( minn, (long long)d * i - v[i] );
        }

        cout << ans / 2;
        if ( ans % 2 == 1 )
            cout << ".5";
        cout << " ";
    }

    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:26:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         for ( int i = 0; i < v.size(); i++ ) {
      |                          ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 136 ms 1376 KB Output is correct
10 Correct 181 ms 3252 KB Output is correct
11 Correct 86 ms 3268 KB Output is correct
12 Correct 196 ms 3272 KB Output is correct
13 Correct 71 ms 2760 KB Output is correct
14 Correct 129 ms 3012 KB Output is correct
15 Correct 117 ms 2508 KB Output is correct
16 Correct 80 ms 3308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1524 ms 1280 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1524 ms 1280 KB Time limit exceeded
2 Halted 0 ms 0 KB -