Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main(){
- int n,m,o;
- cin >> n >> m >> o;
- int x[o],y[o],r[o];
- for(int i=0;i<o;i++){
- cin >> x[i] >> y[i] >> r[i];
- }
- int countx,county,max=0;
- for(int i=1;i<=n;i++){
- countx=0;
- for(int j=0;j<o;j++){
- if(i<=x[j]+r[j]&&i>=x[j]-r[j]){
- countx++;
- }
- }
- if(countx>max) max=countx;
- }
- for(int i=1;i<=m;i++){
- county=0;
- for(int j=0;j<o;j++){
- if(i<=y[j]+r[j]&&i>=y[j]-r[j]){
- county++;
- }
- }
- if(county>max) max=county;
- }
- cout << max;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement