Submission #952693

#TimeUsernameProblemLanguageResultExecution timeMemory
952693doducanhA Huge Tower (CEOI10_tower)C++14
100 / 100
203 ms11984 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int mod=1e9+9; int a[1000005]; int n,k; main() { cin>>n>>k; for(int i=1;i<=n;i++)cin>>a[i]; sort(a+1,a+n+1); int r=0; int sol=1; for(int i=1;i<=n;i++){ while(r<n&&a[r+1]-a[i]<=k)r++; r=max(r,i); int dist=(r-i+1); sol=(1ll*sol*dist)%mod; } cout<<sol; return 0; }

Compilation message (stderr)

tower.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main()
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...