#include <iostream>
using namespace std;
int main()
{ int t;
cin>>t;
int out=0;
while(t--)
{
int a[100000];
int h[100005]={0};
int c[100005]={0};
int i,j,k,n;
//cout<<"enter the sum"<<endl;
cin>>k;
// cout<<"enter the no of elemeents"<<endl;
cin>>n;
j=1;
//cout<<"enter the elements"<<endl;
for(i=0;i<n;i++)
{
cin>>a[i];
}
for(i=0;i<n;i++)
{
if((h[a[i]])==0)
{
//cout<<"y"<<endl;
//h[a[i]]=a[i];
h[a[i]]=a[i];
c[a[i]]=j;
j++;
if(h[a[i]]==k-h[k-a[i]] && k-a[i]!=a[i] && h[k-a[i]]!=0)
{
out++;
cout<<"Case #"<<out<<": "<<c[k-a[i]]<<" "<<i+1<<endl;
//"Case #x: "
break;
}
}
else
{
//cout<<"NO"<<endl;
if(h[a[i]]==k-h[k-a[i]])
{
out++;
cout<<"Case #"<<out<<": "<<c[k-a[i]]<<" "<<i+1<<endl;
break;
}
}
}
}
}
I don't understand the problem with my code.Can You help in sorting out the
solution with the following code.
The error says :Submission for input A-small Rejected: Your output should start
with 'Case #1:
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-code/e2c0ad60-8fed-4c50-b0da-e5c4ebe3fd87%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.