# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1003816 |
2024-06-20T18:21:22 Z |
vjudge1 |
Pastiri (COI20_pastiri) |
C++17 |
|
164 ms |
5712 KB |
#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 ans.pb((pos[i+1]+pos[i])/2);
if(i<pos.size()-1 && (pos[i+1]-pos[i])%2==0) i++;
}
cout << ans.size() << '\n';
for(int x : ans) cout << x << " ";
cout << '\n';
}
Compilation message
pastiri.cpp: In function 'int main()':
pastiri.cpp:21:16: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
21 | for(int i=0; i<pos.size(); i++){
| ~^~~~~~~~~~~
pastiri.cpp:22:7: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
22 | if(i==pos.size()-1) ans.pb(pos[i]);
| ~^~~~~~~~~~~~~~
pastiri.cpp:25:7: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
25 | if(i<pos.size()-1 && (pos[i+1]-pos[i])%2==0) i++;
| ~^~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
157 ms |
404 KB |
Output is correct |
2 |
Incorrect |
163 ms |
5712 KB |
Sheep 25 not protected |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
348 KB |
Sheep 856 not protected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
164 ms |
404 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |