Submission #870827

#TimeUsernameProblemLanguageResultExecution timeMemory
870827vjudge1NLO (COCI18_nlo)C++17
22 / 110
97 ms16728 KiB
//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 timeMemoryGrader output
Fetching results...