Submission #1102663

# Submission time Handle Problem Language Result Execution time Memory
1102663 2024-10-18T15:10:27 Z vladilius Measures (CEOI22_measures) C++17
0 / 100
1500 ms 660 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define pb push_back
#define ff first
#define ss second

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int n, m, d; cin>>n>>m>>d;
    vector<int> a;
    for (int i = 1; i <= n; i++){
        int x; cin>>x;
        a.pb(x);
    }
    
    while (m--){
        int x; cin>>x;
        a.pb(x);
        sort(a.begin(), a.end());
        
        vector<ll> f(a.size());
        f[0] = a[0];
        for (int i = 1; i < a.size(); i++){
            f[i] = max((ll) a[i], f[i - 1] + d);
        }
        
        ll out = 0;
        for (int i = 0; i < f.size(); i++){
            out = max(out, f[i] - a[i]);
        }
        cout<<1.0 * out / 2<<" ";
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:28:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         for (int i = 1; i < a.size(); i++){
      |                         ~~^~~~~~~~~~
Main.cpp:33:27: 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 i = 0; i < f.size(); i++){
      |                         ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 336 KB Output is correct
2 Incorrect 2 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 336 KB Output is correct
2 Incorrect 2 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1560 ms 660 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1560 ms 660 KB Time limit exceeded
2 Halted 0 ms 0 KB -