Submission #1003934

#TimeUsernameProblemLanguageResultExecution timeMemory
1003934vjudge1Pastiri (COI20_pastiri)C++17
8 / 100
95 ms6208 KiB
#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 (stderr)

pastiri.cpp: In function 'int main()':
pastiri.cpp:21:20: warning: unused variable 'ans' [-Wunused-variable]
   21 |     ll n,k,u,v,i=0,ans,sz;
      |                    ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...