Submission #230439

# Submission time Handle Problem Language Result Execution time Memory
230439 2020-05-10T07:02:07 Z NONAME NLO (COCI18_nlo) C++17
33 / 110
3000 ms 504 KB
#include <bits/stdc++.h>
#define sz(x) int(x.size())
#define in(x) freopen(x, "r", stdin)
#define out(x) freopen(x, "w", stdout)
#define N 100500
#define oo ll(1e16)
#define ft first
#define sd second
#define pb push_back
#define ppb pop_back
#define el '\n'
#define elf endl
#define base ll(1e9 + 7)
using namespace std;
typedef long long ll;
typedef long double ld;

ll n, m, k, a[N], b[N], r[N], ans;

ll sqr(ll x) { return x * x; }

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    cin >> n >> m >> k;
    for (int i = 0; i < k; i++)
        cin >> a[i] >> b[i] >> r[i], a[i]--, b[i]--;

    for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
        int p = -1;

        for (int l = 0; l < k; l++)
            if (sqr(abs(i - a[l])) + sqr(abs(j - b[l])) <= sqr(r[l]))
                p = l;

        ans += k - 1 - p;
    }

    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 132 ms 384 KB Output is correct
2 Correct 164 ms 384 KB Output is correct
3 Correct 2534 ms 504 KB Output is correct
4 Execution timed out 3071 ms 384 KB Time limit exceeded
5 Execution timed out 3090 ms 384 KB Time limit exceeded
6 Execution timed out 3077 ms 384 KB Time limit exceeded
7 Execution timed out 3076 ms 384 KB Time limit exceeded
8 Execution timed out 3061 ms 384 KB Time limit exceeded
9 Execution timed out 3082 ms 384 KB Time limit exceeded
10 Execution timed out 3071 ms 384 KB Time limit exceeded