Submission #778833

#TimeUsernameProblemLanguageResultExecution timeMemory
778833amunduzbaevMeetings (IOI18_meetings)C++17
Compilation error
0 ms0 KiB
#include "meetings.h" #include "bits/stdc++.h" using namespace std; #ifndef EVAL #include "grader.cpp" #endif #define ar array typedef int64_t ll; typedef int32_t ii; vector<ll> minimum_costs(vector<int> a, vector<int> l, vector<int> r) { int n = a.size(), q = l.size(); if(n <= 5000 && q <= 5000){ vector<ll> res(q); auto get = [&](vector<int> a){ int n = a.size(); ll cur = 0; vector<int> ss; vector<ll> cost(n); for(int i=0;i<n;i++){ while(!ss.empty() && a[ss.back()] <= a[i]){ int id = ss.back(); ss.pop_back(); if(ss.empty()) cur -= a[id] * 1ll * (id + 1); else cur -= a[id] * 1ll * (id - ss.back()); } if(ss.empty()) cur += a[i] * 1ll * (i + 1); else cur += a[i] * 1ll * (i - ss.back()); ss.push_back(i); cost[i] += cur; } ss.clear(); cur = 0; for(int i= n - 1;~i;i--){ while(!ss.empty() && a[ss.back()] <= a[i]){ int id = ss.back(); ss.pop_back(); if(ss.empty()) cur -= a[id] * 1ll * (n - id); else cur -= a[id] * 1ll * (ss.back() - id); } if(ss.empty()) cur += a[i] * 1ll * (n - i); else cur += a[i] * 1ll * (ss.back() - i); ss.push_back(i); cost[i] += cur; } ll mn = 1e18; for(int i=0;i<n;i++){ mn = min(mn, cost[i] - a[i]); } return mn; }; for(int i=0;i<q;i++){ vector<int> b; for(int j=l[i];j<=r[i];j++){ b.push_back(a[j]); } res[i] = get(b); } return res; } assert(false); vector<ll> res(q); return res; }

Compilation message (stderr)

meetings.cpp:14:12: error: ambiguating new declaration of 'std::vector<long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)'
   14 | vector<ll> minimum_costs(vector<int> a, vector<int> l, vector<int> r) {
      |            ^~~~~~~~~~~~~
In file included from meetings.cpp:1:
meetings.h:5:24: note: old declaration 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)'
    5 | std::vector<long long> minimum_costs(std::vector<int> H, std::vector<int> L,
      |                        ^~~~~~~~~~~~~