# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
412069 |
2021-05-26T13:16:02 Z |
최서현(#7464) |
Pastiri (COI20_pastiri) |
C++17 |
|
358 ms |
28476 KB |
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#define pii pair<int, int>
#define piii pair<int, pii>
#define pll pair<long long, long long>
#define plll pair<long long, pll>
#define tiii tuple<int, int, int>
#define tiiii tuple<int, int, int, int>
#define ff first
#define ss second
#define ee ss.ff
#define rr ss.ss
#define DEBUG
using namespace std;
vector<int> gph[505050];
bool chc[505050];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, k; cin >> n >> k;
for(int i = 1; i < n; ++i)
{
int x, y; cin >> x >> y; --x; --y;
gph[x].push_back(y);
gph[y].push_back(x);
}
for(int i = 0; i < k; ++i)
{
int x; cin >> x; --x;
chc[x] = true;
}
vector<int> V;
int dp[k + 1]{};
for(int i = 0; i < n; ++i) if(chc[i]) V.push_back(i);
for(int i = 0; i < k; ++i)
{
if(i > 0 && (V[i] - V[i - 1]) % 2 == 0) dp[i + 1] = 1 + dp[i - 1];
else dp[i + 1] = 1 + dp[i];
}
cout << dp[k];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
165 ms |
27732 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
12236 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
12236 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
358 ms |
28476 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |