| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1014468 | vjudge1 | The short shank; Redemption (BOI21_prison) | C++17 | 213 ms | 151864 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int MAXN=2e6+5;
int n,d,T,a[MAXN];
int q[MAXN],tp;
bool fuc[MAXN];
int head[MAXN],tot;
struct node{int nxt,to;}e[MAXN<<1];
inline void add(int u,int v){
e[++tot].nxt=head[u];
e[tot].to=v;
head[u]=tot;
}
int dep[MAXN];
basic_string<int>cnt;
inline void dfs(int u){
int son=-1;
for(int i=head[u],v;i;i=e[i].nxt){
dfs(v=e[i].to);if(dep[u]<dep[v]){dep[u]=dep[v];son=v;}
}
dep[u]+=fuc[u];
for(int i=head[u],v;i;i=e[i].nxt){
if((v=e[i].to)!=son)cnt.push_back(-dep[v]);
}
}
signed main(){
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(false);
cin>>n>>d>>T;
for(int i=1;i<=n;i++)cin>>a[i];////
for(int i=n;i>=1;i--){
if(a[i]>T)q[++tp]=i;
else{
while(tp&&(a[i]+(q[tp]-i)<=T)){
fuc[q[tp]]=1;add(q[tp-1],q[tp]);tp--;
}
}
}
int ans=tp;
for(int i=1;i<=tp;i++)add(0,q[i]);
dfs(0);cnt.push_back(-dep[0]);
sort(cnt.begin(),cnt.end());
for(int i=0;i<cnt.size()&&i<d;i++)ans-=cnt[i];
cout<<n-ans<<"\n";
}컴파일 시 표준 에러 (stderr) 메시지
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
