Submission #225052

# Submission time Handle Problem Language Result Execution time Memory
225052 2020-04-19T08:32:59 Z MKopchev A Huge Tower (CEOI10_tower) C++14
100 / 100
209 ms 9956 KB
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+9;

int n,d;
vector<int> inp;

int main()
{
    scanf("%i%i",&n,&d);

    for(int i=1;i<=n;i++)
    {
        int val;
        scanf("%i",&val);
        inp.push_back(val);
    }
    sort(inp.begin(),inp.end());

    long long output=1;
    for(int i=0;i<n;i++)
    {
        int pos=lower_bound(inp.begin(),inp.end(),inp[i]-d)-inp.begin();
        output=output*(i-pos+1)%mod;
    }

    printf("%lld\n",output);
    return 0;
}

Compilation message

tower.cpp: In function 'int main()':
tower.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%i%i",&n,&d);
     ~~~~~^~~~~~~~~~~~~~
tower.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%i",&val);
         ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 1152 KB Output is correct
2 Correct 25 ms 1280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 108 ms 3920 KB Output is correct
2 Correct 78 ms 3884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 170 ms 9956 KB Output is correct
2 Correct 209 ms 9480 KB Output is correct