# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
313339 |
2020-10-15T19:43:49 Z |
neki |
NLO (COCI18_nlo) |
C++14 |
|
516 ms |
508 KB |
#include <bits/stdc++.h>
#define loop(i, a, b) for(long long i=a;i<b;i++)
#define pool(i, a, b) for(long long i=a-1;i>=b;i--)
#define fore(i, a) for(auto&& i:a)
#define fi first
#define se second
#define ps(a) push_back(a)
#define pb(a) pop_back(a)
#define sc scanf
#define vc vector
#define pa pair<ll, ll>
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(), a.end()
#define llmax LLONG_MAX/2
#define llmin -LLONG_MAX/2
using namespace std;
#define mn 260000
#define pa pair<ll, ll>
#define ld long double
ll x[mn], y[mn], r[mn];
int main(){
ll n, m, ans=0;cin >> n>>m;
ll k;cin >> k;
loop(i, 2, k+2) cin >> x[i]>>y[i]>>r[i];
loop(i, 1, n+1){
vc<pa> ne;
loop(j, 2, k+2){
ll temp=r[j] * r[j] - (i-x[j]) * (i-x[j]);
if(temp>=0){
temp=sqrt(temp);
ne.ps(make_pair(max((ll) 1, y[j]-temp), -j));
ne.ps(make_pair(min(m+1, y[j]+temp+1), j));
}
}
ll act[110];
loop(j, 0, 110)act[j]=0;
ne.ps(make_pair(1, -1));
ne.ps(make_pair(m+1, 1));
sort(all(ne));
priority_queue<ll> q;
loop(v, 0, (ll)((ll)ne.size()-1)){
if(ne[v].se>0) act[ne[v].se]=0;
else{
act[-ne[v].se]=1;
q.push(-ne[v].se);
}
while(q.size() and !act[q.top()])q.pop();
if(!q.size()) cout << i << endl;
ans+=(k+1-q.top()) * (ne[v+1].fi - ne[v].fi);
}
}
cout << ans <<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Correct |
9 ms |
384 KB |
Output is correct |
3 |
Correct |
8 ms |
384 KB |
Output is correct |
4 |
Correct |
39 ms |
384 KB |
Output is correct |
5 |
Correct |
30 ms |
384 KB |
Output is correct |
6 |
Correct |
218 ms |
392 KB |
Output is correct |
7 |
Correct |
95 ms |
508 KB |
Output is correct |
8 |
Correct |
387 ms |
384 KB |
Output is correct |
9 |
Correct |
173 ms |
384 KB |
Output is correct |
10 |
Correct |
516 ms |
504 KB |
Output is correct |