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

Compile Error

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