답안 #346582

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
346582 2021-01-10T08:54:51 Z Ca7Ac1 A Huge Tower (CEOI10_tower) C++17
컴파일 오류
0 ms 0 KB
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>

#define ll signed long long

using namespace std;

const ll MOD = (ll)10e9 + 9;

int main()
{
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
    //freopen("tower.in", "r", stdin);

    ll N;
    ll D;
    cin >> N >> D;

    vector<ll> blocks(N, 0);
    for (ll i = 0; i < N; i++)
    {
        cin >> blocks[i];
    }

    sort(blocks.begin(), blocks.end(), greater<ll>());

    vector<ll> place(N, 1);
    ll j = 0;
    for (ll i = 0; i < N; i++)
    {
        while (j < N && blocks[i] - blocks[j] <= D)
        {
            j++;
        }

        place[i] = j - i
    }

    vector<ll> count(N, 1);
    for (ll i = N - 2; i >= 0; i--)
    {
        count[i] = (count[i + 1] * place[i]) %= MOD;
    }

    cout << ((count[1] * place[0]) % MOD);
}

Compilation message

tower.cpp: In function 'int main()':
tower.cpp:41:25: error: expected ';' before '}' token
   41 |         place[i] = j - i
      |                         ^
      |                         ;
   42 |     }
      |     ~                    
tower.cpp:47:49: error: lvalue required as left operand of assignment
   47 |         count[i] = (count[i + 1] * place[i]) %= MOD;
      |                                                 ^~~