Submission #388210

#TimeUsernameProblemLanguageResultExecution timeMemory
388210Jisan_1040A Huge Tower (CEOI10_tower)C++14
100 / 100
134 ms10692 KiB
//Bismillahir Rahman-ir Rahim #include <complex> #include <queue> #include <set> #include <unordered_set> #include <list> #include <chrono> #include <random> #include <iostream> #include <algorithm> #include <cmath> #include <string> #include <vector> #include <map> #include<cstdio> #include<cstring> #include<string> #include<stdlib.h> #include<iomanip> #define PI acos(-1) #define F first #define S second #define debug(x) cout<<'>'<<#x<<":"<<x<<endl #define tara ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0) #define Y printf("YES\n") #define N printf("NO\n") #define ll long long #define lll __int128 #define ull unsigned long long #define pii pair<int,int> #define pll pair<long,long> #define eb emplace_back #define pb push_back #define sc scanf #define pf printf #define endl '\n' #define INF 1<<30 #define ll_INF 1LL<<62 const int M=1e5; using namespace std ; int main() { tara ; ll n, d, i, j; cin>>n>>d ; ll a[n+1] ; for(i=1; i<=n; i++)cin>>a[i] ; sort(a+1, a+n+1); ll st=1, ans=1; for(i=2; i<=n; i++) { while(st <= n && a[st]+d < a[i]) ++st; //cout<<i<<" "<<st<<endl ; ans= (ans*(i-st+1) % 1000000009); } cout<<ans<<endl; }

Compilation message (stderr)

tower.cpp: In function 'int main()':
tower.cpp:49:14: warning: unused variable 'j' [-Wunused-variable]
   49 |  ll n, d, i, j;
      |              ^
#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...