제출 #557704

#제출 시각아이디문제언어결과실행 시간메모리
557704Yazan_AlattarPastiri (COI20_pastiri)C++14
0 / 100
93 ms7208 KiB
#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;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...