답안 #870827

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
870827 2023-11-09T08:51:13 Z vjudge1 NLO (COCI18_nlo) C++17
22 / 110
97 ms 16728 KB
//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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 82 ms 7516 KB Output is correct
2 Correct 97 ms 8300 KB Output is correct
3 Runtime error 11 ms 16728 KB Execution killed with signal 11
4 Runtime error 19 ms 16476 KB Execution killed with signal 11
5 Runtime error 48 ms 16468 KB Execution killed with signal 11
6 Runtime error 39 ms 16468 KB Execution killed with signal 11
7 Runtime error 78 ms 16464 KB Execution killed with signal 11
8 Runtime error 81 ms 16412 KB Execution killed with signal 11
9 Runtime error 77 ms 16472 KB Execution killed with signal 11
10 Runtime error 97 ms 16468 KB Execution killed with signal 11