Submission #931741

# Submission time Handle Problem Language Result Execution time Memory
931741 2024-02-22T10:21:12 Z pcc A Huge Tower (CEOI10_tower) C++14
100 / 100
118 ms 8740 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>


const ll mod = 1e9+9;
vector<int> v;
ll N,D;

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>N>>D;
	v.resize(N);
	for(auto &i:v)cin>>i;
	sort(v.rbegin(),v.rend());
	int pt = 0;
	ll ans = 1;
	for(int i = 0;i<v.size();i++){
		while(pt<i&&v[pt]-v[i]>D)pt++;
		ll len = i-pt+1;
		ans = ans*len%mod;
	}
	cout<<ans;
}

Compilation message

tower.cpp: In function 'int main()':
tower.cpp:24:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |  for(int i = 0;i<v.size();i++){
      |                ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 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 0 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 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 1 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 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 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 2 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1116 KB Output is correct
2 Correct 10 ms 1116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 39 ms 3676 KB Output is correct
2 Correct 36 ms 3860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 86 ms 8740 KB Output is correct
2 Correct 118 ms 8128 KB Output is correct