# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
870827 | vjudge1 | NLO (COCI18_nlo) | C++17 | 97 ms | 16728 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//author: Ahmet Alp Orakci
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define int i64
const int MAXN = 1E3 + 5;
int matrix[MAXN][MAXN];
int sq(int a) {
return a * a;
}
#define ONLINE_JUDGE
void solve() {
int n, m;
cin >> n >> m;
int k;
cin >> k;
while(k--) {
int x, y, r;
cin >> x >> y >> r;
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= m; j++) {
if(sq(abs(i - x)) + sq(abs(j - y)) > sq(r)) {
matrix[i][j]++;
} else {
matrix[i][j] = 0;
}
}
}
}
int ans = 0;
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= m; j++) {
ans += matrix[i][j];
}
}
cout << ans;
return;
}
signed main() {
#ifndef ONLINE_JUDGE
freopen(".in", "r", stdin);
freopen(".out", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int t = 1; //cin >> t;
for(int i = 1; i <= t; i++) {
solve();
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |