답안 #755997

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
755997 2023-06-10T19:54:53 Z vjudge1 A Huge Tower (CEOI10_tower) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define vi vector<int>
#define vl vector<long long>
#define vii vector<pair<int,int>>
#define vll vector<pair<long long,long long>>
#define pb push_back
#define ll long long
#define ld long double
#define nl '\n'
#define boost ios::sync_with_stdio(false)
#define mp make_pair
#define se second
#define fi first
#define fore(i, y) for(ll i = 0; i < y; i++)
#define forr(i,x,y) for(int i = x;i<=y;i++)
#define forn(i,y,x) for(ll i = y; i >= x; i--)
#define all(v) v.begin(),v.end()
#define sz(v) v.size()
#define clr(v,k) memset(v,k,sizeof(v))
#define rall(v) v.rbegin() , v.rend()
#define pii pair<int,int>
#define pll pair<ll , ll>

const ll MOD = 1e9 + 9;
const ll INF = 1e18 + 1;

ll gcd(ll a , ll b) {return b ? gcd(b , a % b) : a ;} // greatest common divisor (PGCD)
ll lcm(ll a , ll b) {return a * (b / gcd(a , b));} // least common multiple (PPCM)

// HERE IS THE SOLUTION

int main()
{
    cin.tie(0);
    cout.tie(0);
    boost;
    int n , d;
    cin>>n>>d;
    vi v(n);
    ll res = 1;
    fore(i , n)
    {
        cin>>v[i];
    }
    sort(all(v));
    int l = 0 ;
    forr(r , 0 , n-1)
    {
        while(a[l] + d < a[r])
        {
            l++;
        }
        (res = res * (r - l + 1))%=MOD;
    }
    cout<<res<<nl;
}

Compilation message

tower.cpp: In function 'int main()':
tower.cpp:52:15: error: 'a' was not declared in this scope
   52 |         while(a[l] + d < a[r])
      |               ^