제출 #134241

#제출 시각아이디문제언어결과실행 시간메모리
134241reda모임들 (IOI18_meetings)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std ; #define pb push_back #define ll long long #define ld long double #define mp make_pair #define MOD 1000000007 #define endl '\n' #pragma GCC optimize ("O3") #include "meetings.h" #define MAXN 105 ll h[3005]; ll st[3005*4+1]; void build (ll p , ll l, ll r) { if(l==r) { st[p]=h[l]; return ; } build(2*p,l,(l+r)/2); build(2*p+1,(l+r)/2 + 1, r); st[p]=max(st[p*2],st[2*p+1]); } ll query(ll p ,ll i , ll j , ll l ,ll r) { if(r < i || j < l) { return 0; } if(l <= i && j <= r) { return st[p]; } ll mid = (i + j) / 2; ll p1 = query(2*p, i, mid, l, r); ll p2 = query(2*p+1, mid+1, j, l, r); return max(p1,p2); } vector<int> minimum_costs(vector<int>H, vector<int> L, vector<int> R) { vector<int> ans; int N=H.size(); int M=h.size(); for(int i=0;i<H.size();i++) { h[i+1]=H[i]; } for(int i= 0 ;i < M;i ++ ) { int mn=1e9+6; int l= L[i],r=R[i]; for(int j=l ; j<=r;j++) { int c=0; for(int s=l;s<r;s++) { if(s==j)c+=s[i]; else c+=query(1,min(j+1,s+1),max(j+1,s+1),1,N); } mn=min(mn,c); } ans.pb(mn); } return ans; }

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

meetings.cpp: In function 'std::vector<int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)':
meetings.cpp:42:14: error: ambiguating new declaration of 'std::vector<int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)'
 vector<int>  minimum_costs(vector<int>H, vector<int> L, vector<int> R)
              ^~~~~~~~~~~~~
In file included from meetings.cpp:10:0:
meetings.h:5:24: note: old declaration 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)'
 std::vector<long long> minimum_costs(std::vector<int> H, std::vector<int> L,
                        ^~~~~~~~~~~~~
meetings.cpp:46:13: error: request for member 'size' in 'h', which is of non-class type 'long long int [3005]'
     int M=h.size();
             ^~~~
meetings.cpp:47:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
      for(int i=0;i<H.size();i++)
                  ~^~~~~~~~~
meetings.cpp:60:32: error: invalid types 'int[int]' for array subscript
                  if(s==j)c+=s[i];
                                ^