제출 #823296

#제출 시각아이디문제언어결과실행 시간메모리
823296Dremix10모임들 (IOI18_meetings)C++17
4 / 100
5552 ms2124 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; #define F first #define S second #define all(x) (x).begin(),(x).end() typedef long long ll; typedef pair<int,int> pi; typedef pair<ll,ll> pl; const int N = 3e5+5; const ll INF = 1e18+5; const int MOD = 1e9+7; vector<long long> minimum_costs(vector<int> arr, vector<int> L, vector<int> R) { int n = arr.size(); int q = L.size(); int i,j,k; vector<ll> ans(q); for(k=0;k<q;k++){ int x = L[k]; int y = R[k]; ll res = INF; for(i=x;i<=y;i++){ ll curr = 0; int maxi = 0; for(j=i;j<=y;j++){ maxi = max(maxi,arr[j]); curr += maxi; } maxi = arr[i]; for(j=i-1;j>=x;j--){ maxi = max(maxi,arr[j]); curr += maxi; } res = min(res,curr); } ans[k] = res; } 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:16:9: warning: unused variable 'n' [-Wunused-variable]
   16 |     int n = arr.size();
      |         ^
#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...