Saleh127

Untitled

May 18th, 2020
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long int
  4. int main()
  5. {
  6. ll t,r,h,i,j,k,l;
  7. while(cin>>t>>r>>h)
  8. {
  9. ll pt[100],pr[100],ph[100],tc[100][100],rc[100][100],hc[100][100];
  10.  
  11. for(i=0;i<t;i++)
  12. {
  13. cin >> pt[i];
  14. for(j=0;j<r;j++)
  15. {
  16. cin>>tc[i][j];
  17. }
  18. }
  19. for(i=0;i<r;i++)
  20. {
  21. cin>>pr[i];
  22. for(j=0;j<h;j++)
  23. {
  24. cin>>rc[i][j];
  25. }
  26. }
  27. for(i=0;i<h;i++)
  28. {
  29. cin>>ph[i];
  30. for(j=0;j<t;j++)
  31. {
  32. cin>>hc[i][j];
  33. }
  34. }
  35. ll a=INT_MAX,price,c,d,e,f=0;
  36. for(i=0;i<t;i++)
  37. {
  38. for(j=0;j<r;j++)
  39. {
  40. for(k=0;k<h;k++)
  41. {
  42. if(tc[i][j]==0 && rc[j][k]==0 && hc[k][i]==0)
  43. {
  44. f=1;
  45. price=pt[i]+pr[j]+ph[k];
  46. if(price<a)
  47. {
  48. a=price;
  49. c=i;
  50. d=j;
  51. e=k;
  52. }
  53. }
  54. }
  55. }
  56. }
  57. if(!f) printf("Don't get married!\n");
  58. else
  59. {
  60. printf("%lld %lld %lld:%lld\n",c,d,e,a);
  61. }
  62. }
  63. return 0;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment