Advertisement
DontCallMeNuttoPleas

Mafia

Mar 31st, 2020
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main(){
  4.     int n,m,o;
  5.     cin >> n >> m >> o;
  6.     int x[o],y[o],r[o];
  7.     for(int i=0;i<o;i++){
  8.         cin >> x[i] >> y[i] >> r[i];
  9.     }
  10.     int countx,county,max=0;
  11.     for(int i=1;i<=n;i++){
  12.         countx=0;
  13.         for(int j=0;j<o;j++){
  14.             if(i<=x[j]+r[j]&&i>=x[j]-r[j]){
  15.                 countx++;
  16.             }
  17.         }
  18.         if(countx>max) max=countx;
  19.     }
  20.     for(int i=1;i<=m;i++){
  21.         county=0;
  22.         for(int j=0;j<o;j++){
  23.             if(i<=y[j]+r[j]&&i>=y[j]-r[j]){
  24.                 county++;
  25.             }
  26.         }
  27.         if(county>max) max=county;
  28.     }
  29.    
  30.     cout << max;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement