# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
551978 | 2022-04-22T04:42:08 Z | aadit_ambadkar | Burza (COCI16_burza) | C++11 | 62 ms | 3268 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back vector<int>v[402], q[402]; int n, k, level[402], st[402], dr[402], pz; void dfs(int dad, int nod) { if(nod) level[nod] = level[dad] + 1; if(level[nod] == k-1) { st[nod] = pz++; dr[nod] = pz; return; } st[nod] = pz; for(int i = 0; i < v[nod].size(); ++i) { int vecin = v[nod][i]; if(vecin == dad) continue; dfs(nod, vecin); } dr[nod] = pz; } bool dp[402][(1<<20)]; bool solve() { dp[0][0] = 1; for(int i = 1; i < n; ++i) q[st[i]].push_back(i); for(int i = 0; i < pz; ++i) { for(int j = 0; j < (1<<k); ++j) { if (!dp[i][j]) continue; for(int jj = 0; jj < q[i].size(); ++jj) { int it = q[i][jj]; if (!(j >> level[it] & 1)) dp[dr[it]][j | (1<<level[it])] = 1; } } } for(int j = 0; j < (1<<k); ++j) if (dp[pz][j]) return 1; return 0; } int main() { cin >> n >> k; if (k*k >= n) { cout << "DA\n"; return 0; } for (int i = 1; i < n; i++) { int a, b; cin >> a >> b; a--; b--; v[a].push_back(b); v[b].push_back(a); } level[0]=-1; dfs(-1, 0); cout << (solve() ? "DA\n" : "NE\n"); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 884 KB | Output is correct |
2 | Correct | 40 ms | 2524 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 980 KB | Output is correct |
6 | Correct | 0 ms | 468 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 59 ms | 2672 KB | Output is correct |
2 | Correct | 39 ms | 2480 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 60 ms | 2872 KB | Output is correct |
6 | Correct | 1 ms | 980 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 54 ms | 2764 KB | Output is correct |
2 | Correct | 44 ms | 2428 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 852 KB | Output is correct |
6 | Correct | 1 ms | 468 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 14 ms | 1260 KB | Output is correct |
2 | Correct | 55 ms | 3268 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 724 KB | Output is correct |
6 | Correct | 0 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 38 ms | 2252 KB | Output is correct |
2 | Correct | 47 ms | 2824 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 980 KB | Output is correct |
6 | Correct | 1 ms | 852 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 53 ms | 2672 KB | Output is correct |
2 | Correct | 50 ms | 2740 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 852 KB | Output is correct |
6 | Correct | 1 ms | 724 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 60 ms | 2956 KB | Output is correct |
2 | Correct | 51 ms | 2792 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 62 ms | 3116 KB | Output is correct |
6 | Correct | 1 ms | 852 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 14 ms | 1200 KB | Output is correct |
2 | Correct | 46 ms | 2660 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 724 KB | Output is correct |
6 | Correct | 2 ms | 980 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 724 KB | Output is correct |
2 | Correct | 60 ms | 2892 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 724 KB | Output is correct |
6 | Correct | 1 ms | 980 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 24 ms | 1616 KB | Output is correct |
2 | Correct | 57 ms | 2852 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 25 ms | 1760 KB | Output is correct |
6 | Correct | 1 ms | 596 KB | Output is correct |