제출 #298015

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
2980152020-09-12 09:47:08miss_robot휴가 (IOI14_holiday)C++14
100 / 100
2195 ms60448 KiB
#include <bits/stdc++.h>
#include"holiday.h"
#pragma GCC optimize("Ofast")
#define ll long long
using namespace std;
const int L = 131072;
vector<int> t[2*L];
vector<ll> p[2*L];
ll qry(int i, int l, int r, int k){
if(k <= 0) return 0;
if(i >= L) return p[i][k-1];
int a = lower_bound(t[i].begin(), t[i].end(), l)-t[i].begin(),
b = upper_bound(t[i].begin(), t[i].end(), r)-t[i].begin();
if(b-a == k) return p[i][b-1] - (a?p[i][a-1]:0);
a = lower_bound(t[i<<1|1].begin(), t[i<<1|1].end(), l)-t[i<<1|1].begin(),
b = upper_bound(t[i<<1|1].begin(), t[i<<1|1].end(), r)-t[i<<1|1].begin();
return qry(i<<1, l, r, k-(b-a)) + qry(i<<1|1, l, r, min(k, b-a));
}
ll sum(int l, int r, int k){ // summe der k maximalen elemente im intervall [l, r]
k = min(k, r-l+1);
return qry(1, l, r, k);
}
void div1(int s, int d, int l, int r, int optl, int optr, ll& sol){ // erst nach rechts dann nach links
if(l > r) return;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:59:13: warning: unused variable 'x' [-Wunused-variable]
   59 |   for(auto& x : t[k]) p[k].push_back(tmp.first+(p[k].empty()?0:p[k].back()));
      |             ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...