답안 #1010186

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1010186 2024-06-28T12:51:45 Z Petrix A Huge Tower (CEOI10_tower) C++17
컴파일 오류
0 ms 0 KB
#include <iostream>
#include <algorithm>
using namespace std;

#define MOD 1000000009

long long v[10000001];

int main()
{
    long long n,m,i,rasp,st;
    cin>>n>>m;
    for(i=1;i<=n;i++) cin>>v[i];
    sort(v+1,v+n+1);
    rasp=1;st=1;
    for(i=1;i<=n;i++){
        while(st<i && v[st]+m<v[i])
            st++;
        rasp=(rasp*(i-st+1))%MOD;
    }
    cout<<rasp;
    return 0;
}
#include <iostream>
#include <algorithm>
using namespace std;

#define MOD 1000000009

long long v[10000001];

int main()
{
    long long n,m,i,rasp,st;
    cin>>n>>m;
    for(i=1;i<=n;i++) cin>>v[i];
    sort(v+1,v+n+1);
    rasp=1;st=1;
    for(i=1;i<=n;i++){
        while(st<i && v[st]+m<v[i])
            st++;
        rasp=(rasp*(i-st+1))%MOD;
    }
    cout<<rasp;
    return 0;
}

Compilation message

tower.cpp:30:11: error: redefinition of 'long long int v [10000001]'
   30 | long long v[10000001];
      |           ^
tower.cpp:7:11: note: 'long long int v [10000001]' previously declared here
    7 | long long v[10000001];
      |           ^
tower.cpp:32:5: error: redefinition of 'int main()'
   32 | int main()
      |     ^~~~
tower.cpp:9:5: note: 'int main()' previously defined here
    9 | int main()
      |     ^~~~