Submission #787529

# Submission time Handle Problem Language Result Execution time Memory
787529 2023-07-19T09:10:38 Z doowey Measures (CEOI22_measures) C++17
24 / 100
1500 ms 5372 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, int> pii;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const ll inf = (ll)1e18;

int main(){
    fastIO;
    int n, m;
    ll d;
    cin >> n >> m >> d;
    vector<ll> p(n);
    for(int i = 0 ; i < n; i ++ ){
        cin >> p[i];
    }
    ll x;
    ll big;
    ll jv;
    for(int i = 0 ; i < m ; i ++ ){
        cin >> x;
        p.push_back(x);
        sort(p.begin(), p.end());
        jv=-inf;
        big=0ll;
        for(int ii = 0 ; ii < p.size(); ii ++ ){
            big=max(big, ii * 1ll * d - p[ii] + jv);
            jv=max(jv,p[ii]-ii*1ll*d);
        }
        cout << big/2ll;
        if(big % 2 == 0) cout << " ";
        else cout << ".5 ";
    }
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:33:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |         for(int ii = 0 ; ii < p.size(); ii ++ ){
      |                          ~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 356 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 360 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 356 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 360 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 352 KB Output is correct
9 Correct 101 ms 5328 KB Output is correct
10 Correct 142 ms 5372 KB Output is correct
11 Correct 43 ms 5332 KB Output is correct
12 Correct 146 ms 5332 KB Output is correct
13 Correct 44 ms 4820 KB Output is correct
14 Correct 96 ms 5340 KB Output is correct
15 Correct 89 ms 4680 KB Output is correct
16 Correct 46 ms 5336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1573 ms 744 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1573 ms 744 KB Time limit exceeded
2 Halted 0 ms 0 KB -