# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1003977 | vjudge1 | Pastiri (COI20_pastiri) | C++17 | 165 ms | 6840 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define pii pair<int,int>
#define tii tuple<int,int,int,int,int>
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
signed main(){
int n,k; cin >> n >> k;
for(int i=1; i<n; i++){
int a,b; cin >> a >> b;
}
vector<int> pos(k);
for(int& x : pos) cin >> x;
vector<int> ans;
for(int i=0; i<pos.size(); i++){
if(i==pos.size()-1) ans.pb(pos[i]);
else{
int dist2 = pos[i+1]+pos[i];
ans.pb(dist2/2);
i+=((dist2%2)==0);
}
}
cout << ans.size() << '\n';
for(int x : ans) cout << x << " ";
cout << '\n';
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |