# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
899723 | 2024-01-06T22:50:52 Z | ivaziva | A Huge Tower (CEOI10_tower) | C++14 | 607 ms | 2140 KB |
#include <bits/stdc++.h> using namespace std; #define MOD 1000000009 #define MAXN 100010 long long n,d; long long niz[MAXN]; vector<long long> levo,desno; void mergee(long long l,long long mid,long long r) { for (long long i=l;i<=mid;i++) levo.push_back(niz[i]); for (long long i=mid+1;i<=r;i++) desno.push_back(niz[i]); long long poz1=0,poz2=0; long long poz=l; while (poz1<levo.size() and poz2<desno.size()) { if (levo[poz1]<desno[poz2]) { niz[poz]=levo[poz1]; poz1++;poz++; } else { niz[poz]=desno[poz2]; poz2++;poz++; } } while (poz1<levo.size()) { niz[poz]=levo[poz1]; poz1++;poz++; } while (poz2<desno.size()) { niz[poz]=desno[poz2]; poz2++;poz++; } levo.clear();desno.clear(); } void mergesort(long long l,long long r) { if (l>=r) return; long long mid=(l+r)/2; mergesort(l,mid); mergesort(mid+1,r); mergee(l,mid,r); } int main() { ios_base::sync_with_stdio(false); ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>n>>d; for (long long i=1;i<=n;i++) cin>>niz[i]; mergesort(1,n); long long ans=1; for (long long i=2;i<=n;i++) { long long j=i-1; while (j>=1 and niz[i]-niz[j]<=d) j--; long long br=i-j; ans*=br; if (ans>=MOD) ans%=MOD; } cout<<ans<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 488 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 35 ms | 1240 KB | Output is correct |
2 | Correct | 607 ms | 1240 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 8 ms | 2140 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 9 ms | 2140 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |