Submission #1073760

#TimeUsernameProblemLanguageResultExecution timeMemory
1073760shezittMeetings (IOI18_meetings)C++14
4 / 100
73 ms2908 KiB
#include <bits/stdc++.h> #include "meetings.h" using ll = long long; #define fore(a, b, c) for(int a=b; a<c; ++a) #define all(x) x.begin(), x.end() #define sz(x) (int)x.size() using namespace std; std::vector<ll> minimum_costs(vector<int> H, vector<int> L, vector<int> R) { int Q = L.size(); vector<ll> C(Q); int N = 0; for (int j = 0; j < Q; ++j) { N = max(N, R[j]); } N++; if(Q <= 10 && N <= 3001){ // sb 1 for(int j=0; j<Q; ++j){ int l = L[j], r = R[j]; ll ans = 4e18; for(int x=l; x<=r; ++x){ ll cur = 0; ll mx = H[x]; for(int i=x; i>=l; --i){ mx = max(mx, 1ll * H[i]); cur += mx; } mx = H[x]; for(int i=x+1; i<=r; ++i){ mx = max(mx, 1ll * H[i]); cur += mx; } ans = min(ans, cur); } C[j] = ans; } return C; } // sb2 vector<int> doses; fore(i, 0, N){ if(H[i] == 2){ doses.push_back(i); } } fore(j, 0, Q){ int l = L[j], r = R[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:69:13: warning: unused variable 'l' [-Wunused-variable]
   69 |         int l = L[j], r = R[j];
      |             ^
meetings.cpp:69:23: warning: unused variable 'r' [-Wunused-variable]
   69 |         int l = L[j], r = R[j];
      |                       ^
meetings.cpp:61:17: warning: control reaches end of non-void function [-Wreturn-type]
   61 |     vector<int> doses;
      |                 ^~~~~
#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...