I am getting TLE in a problems submission
the link to the problem is
CSUM Problem - CodeChef
My solution to this problem
Blockquote
#include<bits/stdc++.h>
using namespace std;
/*
do not voilate rules
*/
void fastio()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
int main()
{
fastio();
long long int t;//number of testcase
cin>>t;
while(tβ)
{
long long int n,k,x;
cin>>n>>k;
vectorvec;
for(long long int i=0;i<n;i++)
{
cin>>x;
vec.push_back(x);
}
bool print=false;
for(long long int i=0;i<n;i++)
{
auto it=find(vec.begin(),vec.end(),k-vec[i]);
if(it!=vec.end()&&abs((it-vec.begin())!=i))
{
cout<<βYesβ<<endl;
print=true;
break;
}
}
if(!print)
cout<<"No"<<endl;
}
}
please help me . I am getting this question as partially correct.
@tmwilliamlin @df