#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define len(x) x.size()
#define debug(x) cout << #x << " is " << x << endl
using namespace std;
typedef long long ll;
typedef long double ld;
const ll N = 32;
const ll oo = 1e9 + 7;
const ll valid[10] = {8 + 2, 2, 8 + 1, 1 + 2 + 4, 2 + 16, 1 + 4 + 16, 8 + 4, 1 + 2, 1 + 4 + 8 + 16, 1 + 2 + 4 + 16};
ll sum(ll x, ll y)
{
return (x + y) % oo;
}
ll mult(ll x, ll y)
{
return (x * y) % oo;
}
vector <vector <ll> > mult(vector <vector <ll> > a, vector <vector <ll> > b)
{
vector <vector <ll> > c;
c.resize(N);
for (ll i = 0; i < N; i++) c[i].resize(N);
for (ll i = 0; i < N; i++)
for (ll j = 0; j < N; j++)
{
c[i][j] = 0;
for (ll c1 = 0; c1 < N; c1++) c[i][j] = sum(c[i][j], mult(a[i][c1], b[c1][j]));
}
return c;
}
vector <vector <ll> > binpow(vector <vector <ll> > c, ll k)
{
if (k == 1) return c;
if (k & 1) return mult(c, binpow(c, k - 1));
else
{
vector <vector <ll> > c1 = binpow(c, k / 2);
return mult(c1, c1);
}
}
int main()
{
int n, k;
cin >> n >> k;
for (int i = 0; i < n - 1; i++)
{
int x, y;
cin >> x >> y;
}
n = k;
int a[n];
for (int i = 0; i < n; i++) cin >> a[i];
vector <int> ans;
for (int i = 0; i < n; i++)
{
if (i == n - 1)
{
ans.pb(a[i]);
break;
}
if (!((a[i + 1] - a[i]) & 1))
{
ans.pb((a[i + 1] + a[i]) / 2);
i++;
}
else ans.pb(a[i]);
}
cout << ans.size() << endl;
for (int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
cout << endl;
}
Compilation message
pastiri.cpp: In function 'int main()':
pastiri.cpp:80:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
80 | for (int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
| ~~^~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
313 ms |
364 KB |
Output is correct |
2 |
Incorrect |
318 ms |
492 KB |
Sheep 25 not protected |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
364 KB |
Sheep 856 not protected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
325 ms |
496 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |