제출 #294608

#제출 시각아이디문제언어결과실행 시간메모리
294608Dovran모임들 (IOI18_meetings)C++11
0 / 100
5562 ms1452 KiB
#include <bits/stdc++.h> #include "meetings.h" #define N 100009 #define LL 1000000009 #define pii pair <int, int> #define ff first #define ss second #define sz size #define pb push_back #define ll long long using namespace std; int n, t[N], c[N], v[N]; void gur(int nd, int l, int r){ if(l==r){ t[nd]=v[l]; return; } int md=(l+r)/2; gur(nd*2, l, md); gur(nd*2+1, md+1, r); t[nd]=max(t[nd*2], t[nd*2+1]); } int tap(int nd, int l, int r, int x, int y){ if(l>=x and r<=y) return t[nd]; if(l>y or r<x) return 0; int md=(l+r)/2; return max(tap(nd*2, l, md, x, y), tap(nd*2+1, md+1, r, x, y)); } std::vector<ll> minimum_costs(std::vector<int>H, std::vector<int>L, std::vector<int>R){ n=H.sz(); for(int i=0; i<n; i++) v[i]=H[i]; gur(1, 0, n-1); vector<ll>e; for(int i=0; i<L.sz(); i++){ int l=L[i], r=R[i]; for(int j=l; j<=r; j++) c[j]=1e9; for(int j=l; j<=r; j++){ int ans=0; for(int h=l; h<=r; h++){ if(h<=j) ans+=tap(1, 0, n-1, h, j); else ans+=tap(1, 0, n-1, j, h); } c[j]=ans; } int mn=1e9; for(int h=l; h<=r; h++) mn=min(mn, c[h]); e.pb(mn); } return e; } /* int main(){ int M, q; vector<int>H, A, B; cin>>M>>q; for(int i=0; i<M; i++){ int X; cin>>X; H.pb(X); } for(int i=0; i<q; i++){ int X, Y; cin>>X>>Y; A.pb(X), B.pb(Y); } vector<ll>e=minimum_costs(H, A, B); for(auto i:e) cout<<i<<' '; }*/

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

meetings.cpp: In function 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)':
meetings.cpp:44:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |  for(int i=0; i<L.sz(); 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...