Enormous Input Test ( INTEST ) Time Limit Extended

#include< iostream>
using namespace std;

int main()
{
int n,k,i,in,count=0;
cin>>n>>k;
if(k<=10000000)
{
for(i=0;i<n;i++)
{
cin>>in;
if(in<=1000000000)
{
if(in%k==0)
count++;
}
}
}
cout<<count;
     
return 0;
}
1 Like

This question particularly tests for faster input output methods. cin/cout are considerably slower than scanf/printf.

You can also use getchar_unclocked() for reading integers.

You need not check if the inputs lie under constraints or not. They are given for you to have an idea of which data type to be used and what approach to be implemented to get the output in given time limit. All the inputs will always lie under given constraints.

1 Like

Okay, initially I have coded the program using printf and scanf but after that i changed it to cin and cout. I thought cin and cout are fast. My mistake. Thank you sir.

Yaa printf is faster than cout.

1 Like

You should preferably use getchar_unlocked() as it is real fast.