Submission #135488

# Submission time Handle Problem Language Result Execution time Memory
135488 2019-07-24T06:40:47 Z 송준혁(#3252) A Huge Tower (CEOI10_tower) C++14
100 / 100
169 ms 6236 KB
#include <bits/stdc++.h>
#define MOD 1000000009
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;

int N, K;
LL ans=1;
int A[1010101];

int main(){
	scanf("%d %d", &N, &K);
	for (int i=1; i<=N; i++) scanf("%d", &A[i]);
	sort(A+1, A+N+1, greater<int>());
	int t=1;
	for (int i=1; i<=N; i++){
		while (t<i && A[t] > K+A[i]) t++;
		ans = ans * (i-t+1) % MOD;
	}
	printf("%lld\n", ans);
	return 0;
}

Compilation message

tower.cpp: In function 'int main()':
tower.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &N, &K);
  ~~~~~^~~~~~~~~~~~~~~~~
tower.cpp:13:32: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for (int i=1; i<=N; i++) scanf("%d", &A[i]);
                           ~~~~~^~~~~~~~~~~~~
# 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 376 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 Correct 2 ms 376 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 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 Correct 2 ms 376 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 Correct 2 ms 376 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 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 Correct 3 ms 484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 1016 KB Output is correct
2 Correct 14 ms 1016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 3760 KB Output is correct
2 Correct 65 ms 3788 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 137 ms 6196 KB Output is correct
2 Correct 169 ms 6236 KB Output is correct