I'm trying to solve a problem on france IOI about a card game (named "Reussite" on level 4) that requires outputting every odd number, however I keep getting (0xC0000005) code if my input is bigger than about 48000 and I can't seem to find the error. Help!
here's my code:
#include<bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
int n;cin>>n;vector<int> arr(n+1);
for (int i = 2; i < n+1; ++i) {
int m = i;
//error is in this while loop
while (i*m<=n){arr[i*m]=1;m++;}
}
for (int i = 0; i < n+1; ++i) {
if (arr[i]==0) printf("%d \n",i);
}
}