# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
773950 |
2023-07-05T09:51:29 Z |
vjudge1 |
Pastiri (COI20_pastiri) |
C++17 |
|
114 ms |
13888 KB |
#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
//#define int long long int
#define N 500005
int main(){
lalala;
int n,k;cin>>n>>k;
for(int i=0;i<n-1;i++){int a,b;cin>>a>>b;}
int koyun[k],kacak[k];
for(int i=0;i<k;i++){
cin>>koyun[i];
kacak[i]=0;
}
sort(koyun,koyun+k);
vector<int> simyaci;
for(int i=0;i<k-1;i++){
if((koyun[i+1]-koyun[i])%2==0){
simyaci.push_back((koyun[i]+koyun[i+1])/2);
kacak[i]=kacak[i+1]=1;
i++;
}
}
for(int i=0;i<k;i++){
if(kacak[i])continue;
simyaci.push_back(koyun[i]);
}
cout<<simyaci.size()<<endl;
for(auto u:simyaci)cout<<u<<" ";
cout<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
59 ms |
6860 KB |
Output is correct |
2 |
Correct |
59 ms |
6852 KB |
Output is correct |
3 |
Correct |
60 ms |
6940 KB |
Output is correct |
4 |
Correct |
114 ms |
13888 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Sheep 3030 not protected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Sheep 128 not protected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
65 ms |
7068 KB |
Sheep 54 not protected |
2 |
Halted |
0 ms |
0 KB |
- |