Advertisement
erfanul007

UVa 10662

Jan 9th, 2019
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. typedef long long int ll;
  5. typedef unsigned long long int ull;
  6. typedef vector<int> vi;
  7. typedef vector<vi> vvi;
  8. typedef pair<int,int> pii;
  9. typedef vector< pii > vpii;
  10. typedef set<int> sti;
  11.  
  12. #define pb push_back
  13. #define pob pop_back
  14. #define mp make_pair
  15. #define ff first
  16. #define ss second
  17. #define loop1(i,n) for(int i=1; i<=int(n); i++)
  18. #define loop(i,y) for(int i=0; i<int(y); i++)
  19. #define rloop(i,y) for(int i=int(y)-1; i>=0; i--)
  20. #define read() freopen("input.txt", "r", stdin)
  21. #define write() freopen("output.txt", "w", stdout)
  22. #define cspf(i) printf("Case %d: ", i)
  23. /// Constants
  24. #define eps 1e-9
  25. #define PI acos(-1.0) // 3.1415926535897932
  26.  
  27. int main()
  28. {
  29. read();
  30. int T,R,H;
  31. while(scanf("%d %d %d",&T,&R,&H)!=EOF){
  32. int t[110][110],r[110][110],h[110][110];
  33. int i,j,k,l,m,n,o,p,total,tl;
  34. for(i=0;i<T;i++){
  35. for(j=0;j<R+1;j++)
  36. scanf("%d",&t[i][j]);
  37. }
  38. for(i=0;i<R;i++){
  39. for(j=0;j<H+1;j++)
  40. scanf("%d",&r[i][j]);
  41. }
  42. for(i=0;i<H;i++){
  43. for(j=0;j<T+1;j++)
  44. scanf("%d",&h[i][j]);
  45. }
  46. int mn=99999999,x,y,z;
  47. for(i=0;i<T;i++){
  48. for(j=1;j<R+1;j++){
  49. if(t[i][j]==0){
  50. for(k=1;k<H+1;k++){
  51. if(r[j-1][k]==0){
  52. if(h[k-1][i+1]==0){
  53. total=t[i][0]+r[j-1][0]+h[k-1][0];
  54. if(total<mn){
  55. mn=total;
  56. x=i;
  57. y=j-1;
  58. z=k-1;
  59. }
  60. }
  61. }
  62. }
  63. }
  64. }
  65. }
  66. if(mn==99999999)
  67. printf("Don't get married!\n");
  68. else
  69. printf("%d %d %d:%d\n",x,y,z,mn);
  70. }
  71. return 0;
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement