Submission #596662

#TimeUsernameProblemLanguageResultExecution timeMemory
596662MerakulusA Huge Tower (CEOI10_tower)C++17
Compilation error
0 ms0 KiB
#include <iostream> #include <algorithm> #include <vector> using namespace std; #define mod 1e9 int main(){ int n = 0; int d = 0; int ans = 1; cin >> n >> d; vector<int> size(n); for(int i = 0; i < n; i++){ cin >> size[i]; } sort(size.begin(), size.end()); int r = 0; for(int i = 0; i < n; i++){ while(r < n && size[r] - size[i] <= d){ r += 1; } int tSize = r - i; ans *= tSize % mod; } cout << ans << endl; return 0; }

Compilation message (stderr)

tower.cpp: In function 'int main()':
tower.cpp:32:22: error: invalid operands of types 'int' and 'double' to binary 'operator%'
   32 |         ans *= tSize % mod;
      |                ~~~~~ ^
      |                |
      |                int