Submission #817627

# Submission time Handle Problem Language Result Execution time Memory
817627 2023-08-09T14:13:52 Z t6twotwo Measures (CEOI22_measures) C++17
0 / 100
1500 ms 876 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FFOR(i,a,b,c) for(int i=(a);(c)>0?i<=(b):i>=(b);i+=(c))
#define FOOR(i,a,b) FFOR(i,a,(b)-1,1)
#define ROOF(i,a,b) FFOR(i,(b)-1,a,-1)
#define FOR(i,n) FOOR(i,0,n)
#define ROF(i,n) ROOF(i,0,n)
#define FORR(x,v) for(auto &x:v)
#define vc vector
#define sz(v) (int)((v).size())
#define bg begin()
#define en end()
#define em empty()
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define ppb pop_back()
#define eb emplace_back
#define bk back()
#define fr front()
#define pp pop()
#define all(v) (v).begin(),(v).end()
#define lla(v) (v).rbegin(),(v).rend()
#define f first
#define s second
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,M,D;
    cin>>N>>M>>D;
    vc<int> a(N);
    FORR(x,a)cin>>x;
    FOR(i,M){
        int b;
        cin>>b;
        a.pb(b);
        sort(all(a));
        ll mx=0,ans=0,s=0;
        FOOR(j,1,sz(a)){
            int k=a[j]-a[j-1]-D;
            ans=max(ans,-(s+k-mx));
            mx=max(mx,s+=k);
        }
        cout<<ans/2<<"."<<ans%2*5<<" ";
    }
    return 6/22;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1551 ms 876 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1551 ms 876 KB Time limit exceeded
2 Halted 0 ms 0 KB -