Problem pigeonhole
User Johnnie
Submission Time 2023-11-08 10:36:35
Score 0
Max Time N/A
Max Memory N/A

Compile Error

pigeonhole.cpp: In function ‘int main()’:
pigeonhole.cpp:6:14: error: the value of ‘h’ is not usable in a constant expression
6 | array<int, h> numOfPidgeons {0};
| ^
pigeonhole.cpp:5:9: note: ‘int h’ is not const
5 | int n, h;
| ^
pigeonhole.cpp:6:14: note: in template argument for type ‘long unsigned int’
6 | array<int, h> numOfPidgeons {0};
| ^
pigeonhole.cpp:15:29: error: invalid types ‘int[long long int]’ for array subscript
15 | numOfPidgeons[pidgeon % h] += 1;
| ^
pigeonhole.cpp:19:29: error: invalid types ‘int[long long int]’ for array subscript
19 | numOfPidgeons[pidgeon % h] -= 1;
| ^
pigeonhole.cpp:22:37: error: request for member ‘size’ in ‘numOfPidgeons’, which is of non-class type ‘int’
22 | for (int i = 0; i < numOfPidgeons.size(); i++)
|