# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
976257 |
2024-05-06T11:01:49 Z |
vjudge1 |
Pastiri (COI20_pastiri) |
C++17 |
|
75 ms |
596 KB |
// #pragma GCC optimize("O3,Ofast,unroll-loops")
// #pragma GCC target("avx2,bmi,popcnt")
#include <bits/stdc++.h>
#define lli long long int
#define ld long double
#define REP(i, n) for(int i = 0; (i) < (n); (i)++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define MP make_pair
using namespace std;
void fastio() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
const int N = 1e5 + 5;
const int INF = 1e9 + 500;
const int MOD = 1e9 + 7;
void solve() {
int n, k;
cin >> n >> k;
REP(i, n - 1) {
int u, v;
cin >> u >> v;
}
vector<int> a, b;
REP(i, k) {
int x;
cin >> x;
if(x & 1) a.pb(x);
else b.pb(x);
}
int res = ((int)a.size() - 1) / 2 + 1;
res += ((int)b.size() - 1) / 2 + 1;
cout << res << "\n";
for(int i = 0; i < a.size(); i += 2) {
if(i == (int)a.size() - 1) {
cout << a[i] << " ";
}
else {
cout << a[i] + a[i + 1] / 2 << " ";
}
}
for(int i = 0; i < b.size(); i += 2) {
if(i == (int)b.size() - 1) {
cout << b[i] << " ";
}
else {
cout << b[i] + b[i + 1] / 2 << " ";
}
}
}
signed main() {
fastio();
solve();
}
Compilation message
pastiri.cpp: In function 'void solve()':
pastiri.cpp:41:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
41 | for(int i = 0; i < a.size(); i += 2) {
| ~~^~~~~~~~~~
pastiri.cpp:50:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
50 | for(int i = 0; i < b.size(); i += 2) {
| ~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
61 ms |
596 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Integer 6918 violates the range [1, 5000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Integer 2585 violates the range [1, 2000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
75 ms |
432 KB |
Integer 507067 violates the range [1, 500000] |
2 |
Halted |
0 ms |
0 KB |
- |