Submission #294596

#TimeUsernameProblemLanguageResultExecution timeMemory
294596DovranMeetings (IOI18_meetings)C++11
Compilation error
0 ms0 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]; 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<int>e; for(int i=0; i<L.sz(); i++){ int l=L[i], r=R[i]; for(int j=0; j<n; 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, in; for(int h=0; h<n; h++){ mn=min(mn, c[h]); if(mn==c[h]) in=h; } e.pb(in); } return e; }

Compilation message (stderr)

meetings.cpp: In function 'void gur(int, int, int)':
meetings.cpp:18:9: error: 'v' was not declared in this scope
   18 |   t[nd]=v[l];
      |         ^
meetings.cpp: In function 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)':
meetings.cpp:41:3: error: 'v' was not declared in this scope
   41 |   v[i]=H[i];
      |   ^
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++){
      |               ~^~~~~~~
meetings.cpp:48:17: error: expected ';' before '<=' token
   48 |   for(int j=l, j<=r; j++){
      |                 ^~
      |                 ;
meetings.cpp:48:17: error: expected primary-expression before '<=' token
   48 |   for(int j=l, j<=r; j++){
      |                 ^~
meetings.cpp:64:9: error: could not convert 'e' from 'vector<int>' to 'vector<long long int>'
   64 |  return e;
      |         ^
      |         |
      |         vector<int>