Submission #244099

#TimeUsernameProblemLanguageResultExecution timeMemory
244099crossing0verMeetings (IOI18_meetings)C++17
19 / 100
524 ms196856 KiB
#include<bits/stdc++.h> #define ll long long #define pb push_back #define vi vector<int> #define fi first #define se second #define local #ifndef local #include "meetings.h" #endif using namespace std; int Q,n; ll DD[5005][5005]; vector<ll> small(vi H,vi L,vi R) { vector<ll> T(Q); vector<int> e = H,WW(n); sort(e.begin(),e.end()); map<int,int> mp; int cnt = 0; for (int i = 0; i < n; i++) { if (i == 0 || e[i-1] != e[i]) { mp[e[i]] = cnt; WW[cnt] = e[i]; cnt++; } } for (int i = 0; i < n; i++) { int val = 0; ll sum = 0; for (int j = i; j >= 0; j--) { val = max(val,H[j]); sum += val; DD[i][j] = sum; } sum = 0; val = 0; for (int j = i; j < n; j++) { val = max(val,H[j]); sum += val; DD[i][j] = sum; } } for (int i = 0; i < Q; i++) { int l = L[i], r = R[i]; ll ans = LLONG_MAX; for (int x = l ; x <= r; x++) { ll sum = DD[x][r] + DD[x][l] - H[x]; ans = min(ans,sum); } T[i] = ans; } return T; } vector<ll> minimum_costs(vi H, vi L,vi R) { n = H.size(); Q = L.size(); if (n <= 5000 && Q <= 5000) return small(H,L,R); std::vector<long long> C(Q); for (int j = 0; j < Q; ++j) { C[j] = H[L[j]]; } }

Compilation message (stderr)

meetings.cpp: In function 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)':
meetings.cpp:61:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#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...