Submission #381343

# Submission time Handle Problem Language Result Execution time Memory
381343 2021-03-25T06:40:46 Z NONAME Pastiri (COI20_pastiri) C++17
0 / 100
104 ms 7208 KB
#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
template <typename T> inline bool chmin(T& a, const T b) {a = min(a, b); return (a == b);}
template <typename T> inline bool chmax(T& a, const T b) {a = max(a, b); return (a == b);}

const int man = (int)(5e5 + 500);

int n, m;
int a[man];
vector <int> vc;

inline void cls() {
    vc.clear();
}

void solve() {
    cls();

    cin >> n >> m;
    for (int i = 0; i < (n - 1); ++i) {
        int x, y;
        cin >> x >> y;
    }
    for (int i = 0; i < m; ++i) {
        cin >> a[i];
    }

    for (int i = 0; i < m; ++i) {
        if (i == (m - 1)) {
            vc.push_back(a[i]);
        } else {
            int md = (a[i] + a[i + 1]) >> 1;
            vc.push_back(md);
            if (abs(a[i] - md) == abs(a[i + 1] - md)) {
                ++i;
            }
        }
    }

    cout << (int)(vc.size()) << "\n";
    for (auto& i : vc) {
        cout << i << " ";
    }
    cout << "\n";
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int t = 1;
    #ifdef _LOCAL
        system("color a");
        freopen("in.txt", "r", stdin);
        cin >> t;
    #endif

    for (int i = 1; i <= t; ++i) {
        cerr << "Case #" << i << ": \n";
        solve();
        cerr << "\n";
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 92 ms 7020 KB Output is correct
2 Incorrect 103 ms 7020 KB Sheep 25 not protected
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 364 KB Sheep 856 not protected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 420 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 104 ms 7208 KB Output isn't correct
2 Halted 0 ms 0 KB -