제출 #597113

#제출 시각아이디문제언어결과실행 시간메모리
597113yutabi모임들 (IOI18_meetings)C++14
19 / 100
5590 ms7008 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; #define pb push_back typedef long long ll; typedef pair <ll,ll> ii; std::vector<long long> minimum_costs(std::vector<int> H, std::vector<int> L, std::vector<int> R) { vector <ll> ans; for(int i=0;i<L.size();i++) { vector <ll> Ll(1,0); vector <ll> Rr(1,0); ll curr_ans=0; vector <ii> aaaa; for(int j=L[i];j<=R[i];j++) { ll curr_num=1; ll curr_height=H[j]; while(aaaa.size() && curr_height>aaaa.back().first) { curr_ans-=aaaa.back().first*aaaa.back().second; curr_num+=aaaa.back().second; aaaa.pop_back(); } curr_ans+=curr_num*curr_height; aaaa.pb(ii(curr_height,curr_num)); Ll.pb(curr_ans); } aaaa.clear(); curr_ans=0; for(int j=R[i];j>=L[i];j--) { ll curr_num=1; ll curr_height=H[j]; while(aaaa.size() && curr_height>aaaa.back().first) { curr_ans-=aaaa.back().first*aaaa.back().second; curr_num+=aaaa.back().second; aaaa.pop_back(); } curr_ans+=curr_num*curr_height; aaaa.pb(ii(curr_height,curr_num)); Rr.pb(curr_ans); } ll nw_ans=-1; for(int j=0;j<Rr.size();j++) { if(nw_ans==-1 || Ll[j]+Rr[Rr.size()-j-1]<nw_ans) { nw_ans=Ll[j]+Rr[Rr.size()-j-1]; } } ans.pb(nw_ans); } 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:19:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     for(int i=0;i<L.size();i++)
      |                 ~^~~~~~~~~
meetings.cpp:76:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   76 |         for(int j=0;j<Rr.size();j++)
      |                     ~^~~~~~~~~~
#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...