#include<bits/stdc++.h>
using namespace std;
#define int long long
#define X first
#define Y second
int n;int m;
int Q;
int gr[3010][3010];
signed main(){
cin>>n>>m;
cin>>Q;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
gr[i][j]=1;
}
}
while(Q--){
int x;int y;int r;
cin>>x>>y>>r;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
if( ((i-x)*(i-x)+(j-y)*(j-y))<=r*r ){
gr[i][j]=0;
}
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
// cout<<gr[i][j]<<" ";
gr[i][j]++;
}//cout<<endl;
}
//cout<<endl;
}
int ans=0;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
ans+=gr[i][j]-1;
}
}
cout<<ans<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
117 ms |
10808 KB |
Output is correct |
2 |
Correct |
176 ms |
12116 KB |
Output is correct |
3 |
Runtime error |
99 ms |
65536 KB |
Execution killed with signal 11 |
4 |
Runtime error |
44 ms |
65536 KB |
Execution killed with signal 9 |
5 |
Runtime error |
115 ms |
65536 KB |
Execution killed with signal 9 |
6 |
Runtime error |
81 ms |
65536 KB |
Execution killed with signal 9 |
7 |
Runtime error |
153 ms |
65536 KB |
Execution killed with signal 9 |
8 |
Runtime error |
221 ms |
65536 KB |
Execution killed with signal 9 |
9 |
Runtime error |
162 ms |
65536 KB |
Execution killed with signal 9 |
10 |
Runtime error |
268 ms |
65536 KB |
Execution killed with signal 9 |