Submission #373602

# Submission time Handle Problem Language Result Execution time Memory
373602 2021-03-05T08:31:49 Z randomjohnnyh A Huge Tower (CEOI10_tower) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

const int MOD = 1e9 + 9;

int main () {
	int n, d;
	cin >> n >> d;
	vector<int> ar(n);
	for (int i = 0; i < n; i++) {
		cin >> ar[i];
	}
	sort(ar.begin(), ar.end()); //sort the blocks
	ll r = 0, sol = 1;
	for (int l = 0; l < n; l++) {
		while (r < n - 1 && ar[r + 1] - ar[l] <= d) r++; 
		int dist = r - l + 1; //largest tower we can built when ar[l] block is the base
		sol = (sol * 1LL * dist) % MOD;
	}
	cout << sol << '\n';
}

Compilation message

tower.cpp: In function 'int main()':
tower.cpp:15:2: error: 'll' was not declared in this scope
   15 |  ll r = 0, sol = 1;
      |  ^~
tower.cpp:17:10: error: 'r' was not declared in this scope
   17 |   while (r < n - 1 && ar[r + 1] - ar[l] <= d) r++;
      |          ^
tower.cpp:18:14: error: 'r' was not declared in this scope
   18 |   int dist = r - l + 1; //largest tower we can built when ar[l] block is the base
      |              ^
tower.cpp:19:3: error: 'sol' was not declared in this scope
   19 |   sol = (sol * 1LL * dist) % MOD;
      |   ^~~
tower.cpp:21:10: error: 'sol' was not declared in this scope
   21 |  cout << sol << '\n';
      |          ^~~