답안 #862909

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
862909 2023-10-19T11:06:41 Z Trisanu_Das Measures (CEOI22_measures) C++17
24 / 100
1500 ms 5572 KB
#include <bits/stdc++.h>
using namespace std;
#define num long long

int N, M; num D;
 
num compute (vector<num> &res) {
    num ans = 0; 
    vector<num> opt(res.size(), -1);
    for (int i = 0; i < res.size(); i++) opt[i] = D * i - res[i];
    num min_opt = 1e18;
    for (int fin = 0; fin < res.size(); fin ++) {
        min_opt = min(min_opt, opt[fin]);
        ans = max(ans, opt[fin] - min_opt);
    }
    return ans;
}
 
int main() {
    cin >> N >> M >> D;
    vector<num> res;
    for (int i = 0; i < N; i ++) {
        num x; cin >> x;
        res.push_back(x);
    }
    for (int i = 0; i < M; i ++) {
        num x; cin >> x;
        res.push_back(x);
        sort(res.begin(), res.end());
        num total = compute(res);
        cout << total / 2;
        if (total % 2 == 1) cout << ".5";
        cout << ' ';
    }
}

Compilation message

Main.cpp: In function 'long long int compute(std::vector<long long int>&)':
Main.cpp:10:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     for (int i = 0; i < res.size(); i++) opt[i] = D * i - res[i];
      |                     ~~^~~~~~~~~~~~
Main.cpp:12:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for (int fin = 0; fin < res.size(); fin ++) {
      |                       ~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 146 ms 3560 KB Output is correct
10 Correct 181 ms 5548 KB Output is correct
11 Correct 85 ms 5556 KB Output is correct
12 Correct 188 ms 5572 KB Output is correct
13 Correct 77 ms 5060 KB Output is correct
14 Correct 138 ms 5564 KB Output is correct
15 Correct 124 ms 4844 KB Output is correct
16 Correct 88 ms 5564 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1569 ms 1108 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1569 ms 1108 KB Time limit exceeded
2 Halted 0 ms 0 KB -