Submission #1043933

# Submission time Handle Problem Language Result Execution time Memory
1043933 2024-08-05T04:43:47 Z 정민찬(#11007) Measures (CEOI22_measures) C++17
10 / 100
1500 ms 3420 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;

int main() {
    ios_base :: sync_with_stdio(false); cin.tie(NULL);
    ll N, M, D;
    cin >> N >> M >> D;
    vector<ll> a(N);
    for (ll i=0; i<N; i++) {
        cin >> a[i];
    }
    for (ll i=0; i<M; i++) {
        ll nw;
        cin >> nw;
        a.push_back(nw);
        sort(a.begin(), a.end());
        ll ans = 0;
        for (ll i=0; i<a.size(); i++) {
            for (ll j=i+1; j<a.size(); j++) {
                ans = max(ans, D * (j-i) - (a[j] - a[i]));
            }
        }
        if (ans % 2 == 0) cout << ans / 2 << ' ';
        else cout << ans / 2 << ".5 ";
    }

    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:22:23: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         for (ll i=0; i<a.size(); i++) {
      |                      ~^~~~~~~~~
Main.cpp:23:29: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |             for (ll j=i+1; j<a.size(); j++) {
      |                            ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 13 ms 344 KB Output is correct
2 Correct 12 ms 348 KB Output is correct
3 Correct 13 ms 496 KB Output is correct
4 Correct 16 ms 348 KB Output is correct
5 Correct 15 ms 496 KB Output is correct
6 Correct 13 ms 348 KB Output is correct
7 Correct 13 ms 488 KB Output is correct
8 Correct 12 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 344 KB Output is correct
2 Correct 12 ms 348 KB Output is correct
3 Correct 13 ms 496 KB Output is correct
4 Correct 16 ms 348 KB Output is correct
5 Correct 15 ms 496 KB Output is correct
6 Correct 13 ms 348 KB Output is correct
7 Correct 13 ms 488 KB Output is correct
8 Correct 12 ms 492 KB Output is correct
9 Execution timed out 1577 ms 3420 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1552 ms 592 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1552 ms 592 KB Time limit exceeded
2 Halted 0 ms 0 KB -