제출 #982863

#제출 시각아이디문제언어결과실행 시간메모리
982863mariaclara모임들 (IOI18_meetings)C++17
19 / 100
5562 ms6748 KiB
#include "meetings.h"
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
const int MAXN = 4e5+5; 
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define mk make_pair
#define pb push_back
#define fr first
#define sc second

vector<ll> minimum_costs(vector<int> H, vector<int> L, vector<int> R) {
    int N = sz(H), Q = sz(L);
    if(N <= 5000 and Q <= 5000) {
        vector<ll> ans(Q,1e15), p(N);
        vector<int> v(N);

        for(int i = 0; i < N; i++) {
            v[i] = H[i];

            for(int j = i-1; j >= 0; j--)
                v[j] = max(v[j+1], H[j]);
            for(int j = i+1; j < N; j++)
                v[j] = max(v[j-1], H[j]);
            
            p[0] = v[0];
            for(int j = 1; j < N; j++) p[j] = p[j-1] + v[j];

            for(int j = 0; j < Q; j++)
                ans[j] = min(ans[j], p[R[j]] - p[L[j]] + v[L[j]]);
        }

        return ans;
    }
}

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

meetings.cpp: In function 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)':
meetings.cpp:39:1: warning: control reaches end of non-void function [-Wreturn-type]
   39 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...