#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
int t;
cin>>t;
while(t--)
{
ll k,d;
int n,i;
cin>>n>>k;
for(i=0;i<n;i++)
{
cin>>d;
if(d%k==0)
cout<<"1";
else
cout<<"0";
}
cout<<"\n";
}
}
//what’s wrong with this code
Also, use faster I/O if you are getting TLE.
ios_base::sync_with_stdio(false);
cin.tie(0);
In while it is t–
there should not any quotes over 1&0
i have corrected your code so now you can check
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
int t;
cin>>t;
while(t–-)
{
ll k,d;
int n,i;
cin>>n>>k;
for(i=0;i<n;i++)
{
cin>>d;
if(d%k==0)
cout<<1;
else
cout<<0;
}
cout<<"\n";
}
}
it is t–
and compilation showing tle.
still showing tle but if I store all 1 and 0 in array and print it than it get accepted how?
without quotes on 1&0 also showing tle ,I’d already tried that.
It’s weird i did the same but took output in vector and got AC’ed
that what I’m saying ,it get Accepted if took o/p in array or vector but don’t know why my above code got ‘tle’.