Submission #154817

# Submission time Handle Problem Language Result Execution time Memory
154817 2019-09-25T01:06:23 Z arnold518 A Huge Tower (CEOI10_tower) C++14
30 / 100
146 ms 8864 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 1e6;
const ll MOD = 1e9+7;

int N, D;
int A[MAXN+10];
ll ans=1;

int main()
{
    int i, j;

    scanf("%d%d", &N, &D);
    for(i=1; i<=N; i++) scanf("%d", &A[i]);
    sort(A+1, A+N+1);

    for(i=1; i<=N; i++) ans*=A+i-lower_bound(A+1, A+i, A[i]-D)+1, ans%=MOD;
    printf("%lld", ans);
}

Compilation message

tower.cpp: In function 'int main()':
tower.cpp:17:12: warning: unused variable 'j' [-Wunused-variable]
     int i, j;
            ^
tower.cpp:19:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &N, &D);
     ~~~~~^~~~~~~~~~~~~~~~
tower.cpp:20:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(i=1; i<=N; i++) scanf("%d", &A[i]);
                         ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 400 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 404 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 504 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 1016 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 77 ms 3736 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 146 ms 8864 KB Output isn't correct
2 Halted 0 ms 0 KB -