# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
92168 | Kastanda | NLO (COCI18_nlo) | C++11 | 651 ms | 504 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int N = 105;
int n, m, k, X[N], Y[N], R[N];
long long tot;
int main()
{
scanf("%d%d%d", &n, &m, &k);
for (int i = 1; i <= k; i++)
scanf("%d%d%d", &X[i], &Y[i], &R[i]);
tot = 1LL * n * m * k;
for (int i = 1; i <= n; i++)
{
set < int > S;
vector < pair < int , int > > A;
for (int j = 1; j <= k; j++)
if (abs(i - X[j]) <= R[j])
{
int delta = (int)floor(sqrt(1.0 * R[j] * R[j] - 1.0 * (i - X[j]) * (i - X[j])));
A.push_back({Y[j] - delta, j});
A.push_back({Y[j] + delta + 1, -j});
}
sort(A.begin(), A.end());
for (int j = 0; j < A.size(); j++)
{
if (S.size())
tot -= 1LL * (A[j].first - A[j -1].first) * (*S.rbegin());
if (A[j].second > 0)
S.insert(A[j].second);
else
S.erase(-A[j].second);
}
}
return !printf("%lld\n", tot);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |