# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
423139 | Antekb | 팀들 (IOI15_teams) | C++14 | 4099 ms | 97928 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "teams.h"
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb(x) push_back(x);
using namespace std;
const int N=(1<<19);
int n;
vector<int> tab[N+N];
void init(int _N, int A[], int B[]) {
n=_N;
for(int i=0; i<n; i++){
//cerr<<A[i]<<" "<<B[i]<<"\n";
A[i]+=N;
while(A[i]){
tab[A[i]].pb(B[i]);
A[i]/=2;
}
}
for(int i=1; i<N+N; i++)sort(tab[i].begin(), tab[i].end());
}
int count(int l, int r, int y){
int ans=0;
//cerr<<l<<" "<<r<<" "<<y<<" ";
for(l+=N, r+=N; l<r; l>>=1, r>>=1){
if(l&1){
ans+=tab[l].end()-lower_bound(tab[l].begin(), tab[l].end(), y);
l++;
}
if(r&1){
--r;
ans+=tab[r].end()-lower_bound(tab[r].begin(), tab[r].end(), y);
}
}
//cerr<<ans<<"\n";
return ans;
}
int can(int M, int K[]) {
//cerr<<"a\n";
sort(K, K+M);
int dp[M];
for(int i=0; i<M; i++){
dp[i]=K[i]-count(0, K[i]+1, K[i]);
for(int j=0; j<i; j++){
dp[i]=max(dp[i], dp[j]+K[i]-count(K[j]+1, K[i]+1, K[i]));
}
//cerr<<i<<" "<<dp[i]<<"\n";
if(dp[i]>0)return 0;
}
return 1;
}
컴파일 시 표준 에러 (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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |