답안 #954718

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
954718 2024-03-28T12:26:01 Z LucaIlie Measures (CEOI22_measures) C++17
10 / 100
1500 ms 3268 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 ans = 0;
        for ( int l = 0; l < v.size(); l++ ) {
            for ( int r = l + 1; r < v.size(); r++ )
                ans = max( ans, (long long)d * (r - l) - (v[r] - v[l]) );
        }

        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 l = 0; l < v.size(); l++ ) {
      |                          ~~^~~~~~~~~~
Main.cpp:27:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |             for ( int r = l + 1; r < v.size(); r++ )
      |                                  ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 344 KB Output is correct
2 Correct 22 ms 600 KB Output is correct
3 Correct 21 ms 448 KB Output is correct
4 Correct 22 ms 468 KB Output is correct
5 Correct 21 ms 344 KB Output is correct
6 Correct 20 ms 344 KB Output is correct
7 Correct 20 ms 348 KB Output is correct
8 Correct 20 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 344 KB Output is correct
2 Correct 22 ms 600 KB Output is correct
3 Correct 21 ms 448 KB Output is correct
4 Correct 22 ms 468 KB Output is correct
5 Correct 21 ms 344 KB Output is correct
6 Correct 20 ms 344 KB Output is correct
7 Correct 20 ms 348 KB Output is correct
8 Correct 20 ms 348 KB Output is correct
9 Execution timed out 1525 ms 3268 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1551 ms 472 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1551 ms 472 KB Time limit exceeded
2 Halted 0 ms 0 KB -