# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
585678 | 2022-06-29T08:14:41 Z | 반딧불(#8385) | Star Trek (CEOI20_startrek) | C++17 | 1000 ms | 2796 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MOD = 1000000007; ll mpow(ll x, ll y){ if(!y) return 1; if(y%2) return mpow(x, y-1) * x % MOD; ll tmp = mpow(x, y/2); return tmp*tmp%MOD; } int n; ll k; vector<int> link[100002]; int DP[100002]; int DProot[100002]; ll ans; int X, Y; void dfs(int x, int p=-1){ for(auto y: link[x]){ if(y==p) continue; dfs(y, x); if(!DP[y]) DP[x] = 1; } if(x==X){ dfs(Y, x); if(!DP[Y]) DP[x] = 1; } } int main(){ scanf("%d %lld", &n, &k); for(int i=1; i<n; i++){ int x, y; scanf("%d %d", &x, &y); link[x].push_back(y); link[y].push_back(x); link[n+x].push_back(n+y); link[n+y].push_back(n+x); } for(int i=1; i<=n; i++){ for(int j=1; j<=n; j++){ for(int x=1; x<=n+n; x++) DP[x] = 0; X = i, Y = n+j; dfs(1); if(DP[1]) ans++; // else printf("%d %d: Bad\n", i, j); } } printf("%lld", ans%MOD); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2644 KB | Output is correct |
2 | Execution timed out | 1086 ms | 2644 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2644 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2644 KB | Output is correct |
2 | Correct | 17 ms | 2772 KB | Output is correct |
3 | Correct | 17 ms | 2676 KB | Output is correct |
4 | Correct | 16 ms | 2644 KB | Output is correct |
5 | Correct | 16 ms | 2672 KB | Output is correct |
6 | Correct | 15 ms | 2660 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2644 KB | Output is correct |
2 | Correct | 17 ms | 2772 KB | Output is correct |
3 | Correct | 17 ms | 2676 KB | Output is correct |
4 | Correct | 16 ms | 2644 KB | Output is correct |
5 | Correct | 16 ms | 2672 KB | Output is correct |
6 | Correct | 15 ms | 2660 KB | Output is correct |
7 | Execution timed out | 1069 ms | 2796 KB | Time limit exceeded |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2644 KB | Output is correct |
2 | Correct | 17 ms | 2772 KB | Output is correct |
3 | Correct | 17 ms | 2676 KB | Output is correct |
4 | Correct | 16 ms | 2644 KB | Output is correct |
5 | Correct | 16 ms | 2672 KB | Output is correct |
6 | Correct | 15 ms | 2660 KB | Output is correct |
7 | Execution timed out | 1069 ms | 2796 KB | Time limit exceeded |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2644 KB | Output is correct |
2 | Correct | 17 ms | 2772 KB | Output is correct |
3 | Correct | 17 ms | 2676 KB | Output is correct |
4 | Correct | 16 ms | 2644 KB | Output is correct |
5 | Correct | 16 ms | 2672 KB | Output is correct |
6 | Correct | 15 ms | 2660 KB | Output is correct |
7 | Execution timed out | 1069 ms | 2796 KB | Time limit exceeded |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2644 KB | Output is correct |
2 | Correct | 17 ms | 2772 KB | Output is correct |
3 | Correct | 17 ms | 2676 KB | Output is correct |
4 | Correct | 16 ms | 2644 KB | Output is correct |
5 | Correct | 16 ms | 2672 KB | Output is correct |
6 | Correct | 15 ms | 2660 KB | Output is correct |
7 | Execution timed out | 1069 ms | 2796 KB | Time limit exceeded |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2644 KB | Output is correct |
2 | Execution timed out | 1086 ms | 2644 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |