 # Ttuple only 90

https://www.codechef.com/JUNE20B/problems/TTUPLE
in ttuple from current long contest I literally tried billion over random test cases but failed to find the edge case for sub-task 1.
can @admin or anyone help me to find the case.

https://www.codechef.com/viewsolution/34386910

I was getting 90 points because I missed the multplication cases.

@scorchingeagle
Your solution misjudges results of some case as 2 but actual answer is 3.
For example:
T1:
1
-10 -10 -9
9 -7 9

T2:
1
-10 -10 -9
9 -7 9

Now, debug your code with these test cases.

1 Like

thank You. 1 Like

Was it an observation or did you stress test it? If you stress tested it can you share how?

1 Like

Actually while testing my code, I made a few if/else conditions and hence creating some test cases(around 60). So, I just ran his code against those test cases, and, listed the ones that failed.

Any other cases like this? Will be helpfull if u share 'em. 1 Like

Oh okay, so here are is the list of all the test cases that I tried.
Hope that helps! Pastebin Link : 50+ Test Cases for TTUPLE(100pts)

How can someone get even 90 points if they are not being able to solve for all cases ?like multiplication cases?

Actually, CodeChef has weak test cases for 90 and some strong ones for 10, because there is no way one can get 90 and not the 10.

1 Like

yeah even I thought the same,I thought may be after the contest is over many 90s would fail the 80% system test cases

I had the same thing 0pts + 90pts. Instead of stressing myself to find the missing cases, just wrote a brute force for cases with small constraints xD

Not the right thing to do but is surely much easier

nice lol

my code’s output is 3 for your test case, but can you test my piece of code please?
it also have the problem of 90.

``````#include <iostream>
using namespace std;

/*
#include <fstream>
std::ifstream cin("input.txt");
std::ofstream cout("co.txt");

*/
#include <set>
std::set<int>::iterator it;

int gOP(int[],int[]);
void solve();

int main(){
int t;cin>>t;
while(t--)solve();
return 0;
}

void solve(){
bool f = true;
int x,y,res;
cin>>x>>x>>x>>y>>y>>y;
for(int i =0;i<3;i++){
if(x[i]!=y[i])f = false;
}   //case for zero
if(f){cout<<0<<'\n';return;}

res=gOP(x,y);                       //simple cases of 1 and 2
if(res<3){cout<<res<<'\n';return;}

//complicated case 2 starts here
for(int i =0;i<3;i++){
}

for(int i=0;i<3;i++)
for(int j =i+1;j<3;j++){
ddx[ddn]=(x[i]-x[j]);       //collecting interdifference of values of triples ( dd is a random name)
ddy[ddn++]=(y[i]-y[j]);
}

for(int i=0;i<3;i++){
int tx=ddx[i],ty=ddy[i];
if (tx!=0)if(ty%tx==0){
potential_muls[mul_count++]=ty/tx;             // collecting ratio of of dds of x and y
for(int l=0;l<3;l++){
int a=x[l],b=y[l];
if ((ty/tx)!=0)if((b%(ty/tx))==0){
potential_adds[add_count++]=(b/(ty/tx))-a;        // collecting potential + integer in rare case of + *.
}
}
}
}

int tx;      //temporary values of x because we are kinda brute forcing all possible operation on x triple
int pair_ignore_cases,pair_count=1;pair_ignore_cases=4;
for(int k =0;k<3;k++){
pair_ignore_cases[pair_count++]=k;                 // collecting values to ignore while choosig sub values of triple to perform first operation.
}
if(pair_count==1)for(int k=0;k<3;k++)pair_ignore_cases[pair_count++]=k;
for(int k =0;k<pair_count;k++){
if(gOP(tx,y)==1){f=true;break;}
}
if(f)break;
}
if(f){cout<<'2'<<'\n';return;}

for(int i =0;i<mul_count;i++){            //very similar just for multiplication operation.
int pair_ignore_cases,pair_count=1;pair_ignore_cases=4;
for(int k =0;k<3;k++){
if(x[k]!=0)if(y[k]%x[k]==0)if(potential_muls[i]==y[k]/x[k])continue;
pair_ignore_cases[pair_count++]=k;
}
if(pair_count==1)for(int k=0;k<3;k++)pair_ignore_cases[pair_count++]=k;
for(int k =0;k<pair_count;k++){
for(int j =0;j<3;j++)(j==pair_ignore_cases[k])?tx[j]=x[j]:tx[j]=x[j]*potential_muls[i];
if(gOP(tx,y)==1){f=true;break;}
}
if(f)break;
}
if(f){cout<<'2'<<'\n';return;}
cout<<'3'<<'\n';return;
}

int gOP(int x[],int y[]){
int X,Y,r1,r2,index=0,t=0;
for(int i=0;i<3;i++)
if(x[i]!=y[i]){
X[index]=x[i];
Y[index++]=y[i];
}
for(int i=0;i<index;i++){