(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

제출 #1111874

#제출 시각아이디문제언어결과실행 시간메모리
1111874epicci23모임들 (IOI18_meetings)C++17
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h" #include "meetings.h" #define ll long long #define all(v) v.begin() , v.end() #define sz(a) (ll)a.size() using namespace std; const ll INF = 1e18; const int N = 1e6 + 5; ll ar[N]; array<ll,4> seg[4*N]; array<ll,4> merge(array<ll,4> a,array<ll,4> b){ if(a[0]==-1) return b; if(b[0]==-1) return a; array<ll,4> res; res[3]=a[3]+b[3]; res[0]=max(a[0],b[0]); res[0]=max(res[0],a[2]+b[1]); res[2]=b[2]; if(b[0]==b[3]) res[2]=max(res[2],b[0]+a[2]); res[1]=a[1]; if(a[0]==a[3]) res[1]=max(res[1],a[0]+b[1]); res[0]=max(res[0],res[1]); res[0]=max(res[0],res[2]); return res; } void build(int rt,int l,int r){ if(l==r){ seg[rt]={0,0,0,1}; if(ar[l]==1) seg[rt]={1,1,1,1}; return; } int m = (l+r)/2; build(rt*2,l,m),build(rt*2+1,m+1,r); seg[rt]=merge(seg[rt*2],seg[rt*2+1]); } array<int,4> query(int rt,int l,int r,int gl,int gr){ if(r<gl || l>gr) return {-1,-1,-1,-1}; if(l>=gl && r<=gr) return seg[rt]; int m=(l+r)/2; return merge(query(rt*2,l,m,gl,gr),query(rt*2+1,m+1,r,gl,gr)); } vector<long long> minimum_costs(vector<int> H, vector<int> L,vector<int> R){ ll n,q; n=sz(H),q=sz(L); vector<ll> res; for(int i=1;i<=n;i++) ar[i]=H[i-1]; if(n<=5005){ ll mx[n+5][n+5]; for(int i=1;i<=n;i++){ ll hm = ar[i]; for(int j=i;j<=n;j++){ hm=max(hm,ar[j]); mx[i][j]=hm; } } ll pre[n+5][n+5]; memset(pre,0,sizeof(pre)); for(int i=1;i<=n;i++){ ll cur = 0; for(int j=i;j<=n;j++){ cur += mx[i][j]; pre[i][j] = cur; } cur = 0; for(int j=i;j>=1;j--){ cur += mx[j][i]; pre[i][j] = cur; } } for(int i=0;i<q;i++){ ll l,r; l=L[i]+1,r=R[i]+1; ll xd = INF; for(int i=l;i<=r;i++){ ll curi = pre[i][l] + pre[i][r] - ar[i]; xd = min(xd, curi); } res.push_back(xd); } } else{ build(1,1,n); for(int i=0;i<q;i++){ ll l = L[i]+1 , r = R[i] + 1; auto u = query(1,1,n,l,r); res.push_back(2LL*(r-l+1LL) - u[0]); } } return res; } /*void _(){ int n,q; cin >> n >> q; int ar[n+5]; for(int i=1;i<=n;i++) cin >> ar[i]; int mx[n+5][n+5]; for(int i=1;i<=n;i++){ int hm = ar[i]; for(int j=i;j<=n;j++){ hm=max(hm,ar[j]); mx[i][j]=hm; } } int pre[n+5][n+5]; memset(pre,0,sizeof(pre)); for(int i=1;i<=n;i++){ int cur = 0; for(int j=i;j<=n;j++){ cur += mx[i][j]; pre[i][j] = cur; } cur = 0; for(int j=i;j>=1;j--){ cur += mx[j][i]; pre[i][j] = cur; } } while(q--){ int l,r; cin >> l >> r; int res = INF; for(int i=l;i<=r;i++){ int curi = pre[i][l] + pre[i][r] - ar[i]; res = min(res, curi); } cout << res << '\n'; } } int32_t main(){ cin.tie(0); ios::sync_with_stdio(0); int tc=1;//cin >> tc; while(tc--) _(); return 0; }*/

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

meetings.cpp: In function 'std::array<int, 4> query(int, int, int, int, int)':
meetings.cpp:48:35: error: could not convert 'seg[rt]' from 'array<long long int,[...]>' to 'array<int,[...]>'
   48 |   if(l>=gl && r<=gr) return seg[rt];
      |                             ~~~~~~^
      |                                   |
      |                                   array<long long int,[...]>
meetings.cpp:50:63: error: no matching function for call to 'merge(std::array<int, 4>, std::array<int, 4>)'
   50 |   return merge(query(rt*2,l,m,gl,gr),query(rt*2+1,m+1,r,gl,gr));
      |                                                               ^
meetings.cpp:15:13: note: candidate: 'std::array<long long int, 4> merge(std::array<long long int, 4>, std::array<long long int, 4>)'
   15 | array<ll,4> merge(array<ll,4> a,array<ll,4> b){
      |             ^~~~~
meetings.cpp:15:31: note:   no known conversion for argument 1 from 'array<int,[...]>' to 'array<long long int,[...]>'
   15 | array<ll,4> merge(array<ll,4> a,array<ll,4> b){
      |                   ~~~~~~~~~~~~^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from meetings.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:4944:5: note: candidate: 'template<class _IIter1, class _IIter2, class _OIter> _OIter std::merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter)'
 4944 |     merge(_InputIterator1 __first1, _InputIterator1 __last1,
      |     ^~~~~
/usr/include/c++/10/bits/stl_algo.h:4944:5: note:   template argument deduction/substitution failed:
meetings.cpp:50:63: note:   candidate expects 5 arguments, 2 provided
   50 |   return merge(query(rt*2,l,m,gl,gr),query(rt*2+1,m+1,r,gl,gr));
      |                                                               ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from meetings.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:4995:5: note: candidate: 'template<class _IIter1, class _IIter2, class _OIter, class _Compare> _OIter std::merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare)'
 4995 |     merge(_InputIterator1 __first1, _InputIterator1 __last1,
      |     ^~~~~
/usr/include/c++/10/bits/stl_algo.h:4995:5: note:   template argument deduction/substitution failed:
meetings.cpp:50:63: note:   candidate expects 6 arguments, 2 provided
   50 |   return merge(query(rt*2,l,m,gl,gr),query(rt*2+1,m+1,r,gl,gr));
      |                                                               ^
In file included from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from meetings.cpp:1:
/usr/include/c++/10/pstl/glue_algorithm_defs.h:412:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::merge(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _ForwardIterator, _Compare)'
  412 | merge(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
      | ^~~~~
/usr/include/c++/10/pstl/glue_algorithm_defs.h:412:1: note:   template argument deduction/substitution failed:
meetings.cpp:50:63: note:   candidate expects 7 arguments, 2 provided
   50 |   return merge(query(rt*2,l,m,gl,gr),query(rt*2+1,m+1,r,gl,gr));
      |                                                               ^
In file included from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from meetings.cpp:1:
/usr/include/c++/10/pstl/glue_algorithm_defs.h:417:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::merge(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _ForwardIterator)'
  417 | merge(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
      | ^~~~~
/usr/include/c++/10/pstl/glue_algorithm_defs.h:417:1: note:   template argument deduction/substitution failed:
meetings.cpp:50:63: note:   candidate expects 6 arguments, 2 provided
   50 |   return merge(query(rt*2,l,m,gl,gr),query(rt*2+1,m+1,r,gl,gr));
      |                                                               ^