답안 #381606

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
381606 2021-03-25T10:53:49 Z topovik Pastiri (COI20_pastiri) C++14
0 / 100
316 ms 620 KB
#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;
    int i = 0;
    while (i < n)
    {
        if (i == n - 1)
        {
            ans.pb(a[i]);
            i++;
        }
        if (!((a[i + 1] - a[i]) & 1))
        {
            ans.pb((a[i + 1] + a[i]) / 2);
            i += 2;
        }
        else
        {
            ans.pb(a[i]);
            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:85:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   85 |     for (int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
      |                     ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 313 ms 492 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 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 316 ms 620 KB Output isn't correct
2 Halted 0 ms 0 KB -