| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 133039 | eohomegrownapps | Exhibition (JOI19_ho_t2) | C++14 | 266 ms | 133624 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<ll> frames;
vector<pair<ll,ll> > pictures;
vector<ll> fenwick;
ll fsize;
void update(ll x){
//cout<<x<<endl;
while (x<=fsize){
fenwick[x]++;
x+=x&(-x);
}
}
ll get(ll x){
ll ans = 0;
while (x>0){
ans+=fenwick[x];
x-=x&(-x);
}
return ans;
}
int main(){
freopen("exhibition.in","r",stdin);
ll n,m;
cin>>n>>m;
frames.resize(m);
pictures.resize(n);
for (int i = 0; i<n; i++){
cin>>pictures[i].second>>pictures[i].first;
}
sort(pictures.begin(),pictures.end());
for (int i = 0; i<m; i++){
cin>>frames[i];
}
sort(frames.begin(),frames.end());
fenwick.resize(n+m+2,0);
fsize=n+m+1;
ll ans = 0;
int picindex = 0;
for (int i = n+1; i>=1; i--){
//end position at i+m-1
//find first frame >= pictures[picindex].second
auto it = lower_bound(frames.begin(),frames.end(),pictures[picindex].second);
if (it!=frames.end()){
int offset = it-frames.begin();
update(i+offset+1);
}
ans=max(ans,get(i+m));
picindex++;
}
cout<<ans<<endl;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
