Submission #374734

# Submission time Handle Problem Language Result Execution time Memory
374734 2021-03-08T04:45:17 Z wzy A Huge Tower (CEOI10_tower) C++11
30 / 100
134 ms 13676 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = (ll) 1e9 + 9;



int32_t main(){
	int n , d , j = 1;
	scanf("%d%d" , &n , &d);
	vector<int> v(n+1);
	vector<long long> dp(n+1);
	dp[0] = 1;
	for(int i = 1; i <= n; i ++){
		scanf("%d" , &v[i]);
	}
	sort(v.begin() + 1 , v.end());
	dp[1] = 1;
	for(int i = 2; i <= n; i ++){
		while(v[i] > v[j] + d)
			j++;
		dp[i] = dp[i-1] * (i-j+1);
	}
	printf("%lld\n" , dp[n]);
}

Compilation message

tower.cpp: In function 'int32_t main()':
tower.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   10 |  scanf("%d%d" , &n , &d);
      |  ~~~~~^~~~~~~~~~~~~~~~~~
tower.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   15 |   scanf("%d" , &v[i]);
      |   ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 492 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 1388 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 63 ms 5740 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 134 ms 13676 KB Output isn't correct
2 Halted 0 ms 0 KB -