Advertisement
thesonpb

Trò chơi hình chữ nhật (sai test case cuối)

Mar 27th, 2020
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4. int main(){
  5.     vector< vector<int> > a(1000, vector<int> (1000));
  6.     for(int i=0; i<1000; i++){
  7.         for(int j=0; j<1000; j++){
  8.             a[i][j]=0;
  9.         }
  10.     }
  11.     int n;
  12.     cin >> n;
  13.     for(int i=0; i<n; i++){
  14.         int c, b;
  15.         cin >> c >> b;
  16.         for(int y=0; y<c; y++){
  17.             for(int x=0; x<b; x++){
  18.                 a[x][y]++;
  19.             }
  20.         }
  21.     }
  22.     int max=a[0][0];
  23.     for(int i=0; i<1000; i++){
  24.         for(int j=0; j<1000; j++){
  25.             if(a[i][j]>max) max=a[i][j];
  26.         }
  27.     }
  28.     int sum=0;
  29.     for(int i=0; i<1000; i++){
  30.         for(int j=0; j<1000; j++){
  31.             if(a[i][j]==max) sum++;
  32.         }
  33.     }
  34.     cout<<sum;
  35.    
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement