Submission #976257

#TimeUsernameProblemLanguageResultExecution timeMemory
976257vjudge1Pastiri (COI20_pastiri)C++17
0 / 100
75 ms596 KiB
// #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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...