제출 #1073748

#제출 시각아이디문제언어결과실행 시간메모리
1073748shezitt모임들 (IOI18_meetings)C++14
4 / 100
5541 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; int T[6050], n; void update(int idx, int x){ T[idx += n] = x; for(idx /= 2; idx; idx /= 2){ T[idx] = max(T[2*idx], T[2*idx+1]); } } int query(int low, int high){ int ra = 0, rb = 0; for(low += n, high += n + 1; low < high; low /= 2, high /= 2){ if(low & 1) ra = max(ra, T[low++]); if(high & 1) rb = max(rb, T[--high]); } return max(ra, rb); } 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++; n = N; if(Q <= 10 && n <= 3001){ // sb 1 for(int i=0; i<N; ++i){ update(i, H[i]); } 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; for(int i=l; i<=r; ++i){ cur += query(min(i,x), max(i,x)); } ans = min(ans, cur); } C[j] = ans; } return C; } }

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

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