Advertisement
Zinak

Untitled

Sep 4th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. int main()
  5. {
  6. int t,i=0,n,a,b,c,d,mx,p1,p2,mn,j;
  7. string s;
  8. vector<int>v1;
  9. vector<string>v2;
  10. cin>>t;
  11. while(t--)
  12. {
  13. mx=-1e9,mn=1e9;
  14. cin>>n;
  15. while(n--)
  16. {
  17. cin>>s>>a>>b>>c, d=a*b*c;
  18. v2.push_back(s);
  19. v1.push_back(d);
  20. }
  21. for( j=0;j<v1.size();j++)
  22. {
  23. if(v1[j]>mx)
  24. mx=v1[j],p1=j;
  25. if(v1[j]<mn)
  26. mn=v1[j],p2=j;
  27. }
  28. if(mx==mn)
  29. printf("Case %d: no thief\n",++i);
  30. else
  31. printf("Case %d: %s took chocolate from %s\n",++i,v2[p1].c_str(),v2[p2].c_str());
  32.  
  33. }
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement