제출 #862909

#제출 시각아이디문제언어결과실행 시간메모리
862909Trisanu_DasMeasures (CEOI22_measures)C++17
24 / 100
1569 ms5572 KiB
#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 << ' ';
    }
}

컴파일 시 표준 에러 (stderr) 메시지

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 ++) {
      |                       ~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...