# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1003934 | 2024-06-20T20:19:32 Z | vjudge1 | Pastiri (COI20_pastiri) | C++17 | 95 ms | 6208 KB |
#include<bits/stdc++.h> using namespace std; #define N 500010 #define M 50 #define INFLL 2000000000000000020 #define pb push_back typedef long long ll; typedef pair<ll,ll> pll; vector<ll>resp; ll vet[N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n,k,u,v,i=0,ans,sz; cin >> n >> k; while(i<n-1) { cin >> u >> v; i++; } i=0; while(i<k) { cin >> vet[i]; i++; } sort(vet,vet+k); vet[k]=vet[k-1]; for(i=0;i<k;i++) { if((vet[i+1]-vet[i])%2) { resp.pb(vet[i]); }else { resp.pb((vet[i+1]+vet[i])/2); i++; } } sz=(ll)(resp.size()); cout << sz << endl; for(i=0;i<sz;i++) { cout << resp[i] << ((i==sz-1) ? '\n' : ' '); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 41 ms | 348 KB | Output is correct |
2 | Correct | 48 ms | 452 KB | Output is correct |
3 | Correct | 43 ms | 464 KB | Output is correct |
4 | Correct | 95 ms | 6208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Sheep 3030 not protected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Sheep 128 not protected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 47 ms | 460 KB | Sheep 54 not protected |
2 | Halted | 0 ms | 0 KB | - |