제출 #1356684

#제출 시각아이디문제언어결과실행 시간메모리
1356684po_rag526Construction of Highway (JOI18_construction)C++20
0 / 100
0 ms344 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int n,m;
const int MOD=1000000009;

int main(){
    scanf(" %d %d",&n,&m);
    vector<ll> v(n);
    vector<int> per(n);
    for(int i=0;i<n;i++){
        scanf(" %lld",&v[i]);
    }
    ll ans=0;
    iota(per.begin(),per.end(),0);
    do{
        ll p=-1;
        bool con=0;
        for(int idx:per){
            ll a=v[idx];
            if(a>p+m&&p!=-1)con=1;
            p=a;
        }
        if(con)continue;
        ans++;
        ans%=MOD;
    }while(next_permutation( per.begin() , per.end() ));
    printf("%lld",ans);
}

컴파일 시 표준 에러 (stderr) 메시지

construction.cpp: In function 'int main()':
construction.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf(" %d %d",&n,&m);
      |     ~~~~~^~~~~~~~~~~~~~~~
construction.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         scanf(" %lld",&v[i]);
      |         ~~~~~^~~~~~~~~~~~~~~
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…