제출 #1045173

#제출 시각아이디문제언어결과실행 시간메모리
1045173wood모임들 (IOI18_meetings)C++17
0 / 100
1 ms600 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; std::vector<long long> minimum_costs(std::vector<int> H, std::vector<int> L, std::vector<int> R) { int Q = L.size(); std::vector<long long> C(Q); for (int j = 0; j < Q; ++j) { map<int,int> backwards; long long res = LLONG_MAX; for(int i = R[j]; i>=L[j]; i--)backwards[H[i]]++; int mx = 0; for(int i = L[i]; i<=R[i]; i++){ mx = max(mx,H[i]); backwards[H[i]]--; if(backwards[H[i]] == 0) backwards.erase(H[i]); res = min(res,(long long)(i-L[i]+1)*mx+(R[i]-i)*backwards.rbegin()->first); } C[j] = res; } return C; }

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

meetings.cpp: In function 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)':
meetings.cpp:13:19: warning: 'i' may be used uninitialized in this function [-Wmaybe-uninitialized]
   13 |    for(int i = L[i]; i<=R[i]; i++){
      |                   ^
#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...