| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 960754 | doducanh | Burza (COCI16_burza) | C++14 | 39 ms | 1144 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
vector<int>a[405];
map<int,int>lost;
int max_cover[1<<20];
vector<vector<int>>cutoff;
vector<pair<int,int>>intervals;
vector<int>dep[405];
int n,k;
void process(int at,int prev,int depth)
{
dep[depth].push_back(at);
if(depth==k){
lost[at]=lost.size();
cutoff[at]={at};
return;
}
for(int v:a[at])if(v!=prev){
process(v,at,depth+1);
cutoff[at].insert(cutoff[at].end(),cutoff[v].begin(),cutoff[v].end());
}
}
main()
{
cin>>n>>k;
cutoff.resize(n+1);
for(int i=1;i<n;i++){
int x,y;
cin>>x>>y;
x--;
y--;
a[x].push_back(y);
a[y].push_back(x);
}
if(k>=n*n)return cout<<"DA",0;
process(0,0,0);
for(const vector<int>&cc:cutoff){
if(cc.empty()){
intervals.push_back({-1,-1});
}
else intervals.push_back({lost[cc.front()]+1,lost[cc.back()]+1});
}
max_cover[0]=0;
for(int mask=1;mask<(1<<k);mask++){
int &curr=max_cover[mask];
for(int to_add=0;to_add<k;to_add++){
if((mask>>(to_add))&1){
int pre=max_cover[mask^(1<<to_add)];
for(int v:dep[to_add+1]){
if(intervals[v].fi<=(int)pre+1){
curr=max(curr,intervals[v].se);
}
}
}
}
if(max_cover[mask]==lost.size()){
cout<<"DA";
return 0;
}
}
cout<<"NE";
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... | ||||
| # | 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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
