#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define all(x) x.begin(), x.end()
const int M = 500007;
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const double pi = acos(-1);
const double eps = 1e-6;
const int dx[] = {0, -1, 0, 1}, dy[] = {1, 0, -1, 0};
const int block = 320;
int n, k;
vector <int> v, ans;
int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> k;
for(int i = 1; i < n; ++i){
int a;
cin >> a >> a;
}
for(int i = 1; i <= k; ++i){
int x; cin >> x;
v.pb(x);
}
sort(all(v));
for(int i = 0; i < k; ++i){
if(i != k - 1 && (v[i + 1] - v[i]) % 2 == 0){
ans.pb(v[i] + (v[i + 1] - v[i]) / 2);
++i;
}
else ans.pb(v[i]);
}
cout << ans.size() << endl;
for(auto i : ans) cout << i << " ";
cout << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
68 ms |
304 KB |
Output is correct |
2 |
Correct |
68 ms |
312 KB |
Output is correct |
3 |
Correct |
82 ms |
6952 KB |
Output is correct |
4 |
Correct |
140 ms |
13632 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Sheep 3030 not protected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Sheep 128 not protected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
76 ms |
424 KB |
Sheep 54 not protected |
2 |
Halted |
0 ms |
0 KB |
- |