# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
105474 |
2019-04-12T14:39:44 Z |
igzi |
NLO (COCI18_nlo) |
C++17 |
|
305 ms |
13880 KB |
#include <bits/stdc++.h>
using namespace::std;
set <pair<int,int>> s[100005];
long long n,m,k,i,j,a[100005],x[100005],y[100005],r[100005],ans;
long long dodaj(int p,int l,int d){
long long ans,a,b;
ans=d-l+1;
set<pair<int,int>>::iterator it;
while(true){
it=s[p].lower_bound({l,d});
if(it==s[p].end()) break;
if((*it).second<=d) {ans-=(*it).second-(*it).first+1; s[p].erase(it);}
else break;
}
it=s[p].lower_bound({l,d});
a=l;
b=d;
if(it!=s[p].end() && d+1>=(*it).first){
b=(*it).second;
ans-=d+1-(*it).first;
s[p].erase(it);
}
it=s[p].lower_bound({l,d});
if(it!=s[p].begin()){
it--;
if((*it).second+1>=l){
a=(*it).first;
ans-=(*it).second+1-l;
s[p].erase(it);
}
}
s[p].insert({a,b});
return ans;
}
int main(){
std::ios_base::sync_with_stdio(0);
cin>>n>>m>>k;
for(i=0;i<k;i++){
cin>>x[i]>>y[i]>>r[i];
}
ans=n*m*k;
for(i=k-1;i>=0;i--){
a[i]=0;
for(j=y[i]-r[i];j<=y[i]+r[i];j++){
long long d;
d=sqrt(r[i]*r[i]-(j-y[i])*(j-y[i]));
if(d*d>r[i]*r[i]-(j-y[i])*(j-y[i])) d--;
a[i]+=dodaj(j,x[i]-d,x[i]+d);
}
ans-=(i+1)*a[i];
}
cout<<ans<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
9 ms |
5120 KB |
Output isn't correct |
2 |
Incorrect |
12 ms |
5120 KB |
Output isn't correct |
3 |
Incorrect |
11 ms |
5632 KB |
Output isn't correct |
4 |
Incorrect |
41 ms |
5504 KB |
Output isn't correct |
5 |
Incorrect |
42 ms |
8056 KB |
Output isn't correct |
6 |
Incorrect |
125 ms |
7716 KB |
Output isn't correct |
7 |
Incorrect |
109 ms |
12408 KB |
Output isn't correct |
8 |
Incorrect |
224 ms |
9976 KB |
Output isn't correct |
9 |
Incorrect |
124 ms |
13880 KB |
Output isn't correct |
10 |
Incorrect |
305 ms |
11372 KB |
Output isn't correct |