Submission #513807

#TimeUsernameProblemLanguageResultExecution timeMemory
513807wildturtleNLO (COCI18_nlo)C++14
33 / 110
581 ms440 KiB
#include<bits/stdc++.h> #define ll long long #define f first #define sc second #define pb push_back using namespace std; int a,b,c,d,i,e,f,g,n,m,k,l,minn,t,le,ri,maxx,sz,cur,curr; ll ans; pair < pair <int,int> , int> A[500005]; int tree[500005],tree1[500005]; vector < pair <int,int> > v; multiset <int> ms; int main() { std::ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0); cin>>n>>m; cin>>k; for(int i=1;i<=k;i++) { cin>>A[i].f.f>>A[i].f.sc>>A[i].sc; } ans=n*m*k; for(int i=1;i<=n;i++) { v.clear(); ms.clear(); for(int j=k;j>=1;j--) { if(abs(i-A[j].f.f)>A[j].sc) continue; sz=(A[j].sc*A[j].sc)-(abs(i-A[j].f.f)*abs(i-A[j].f.f)); sz=sqrtl(sz); le=A[j].f.sc-sz; ri=A[j].f.sc+sz; v.pb({le,j}); v.pb({ri+1,-j}); } v.pb({m+1,0}); sort(v.begin(),v.end()); for(ll j=0;j<v.size()-1;j++) { if(v[j].sc>=0) ms.insert(v[j].sc); else ms.erase(ms.find(-v[j].sc)); if(ms.size()) { a=*(--ms.end()); ans-=a*(v[j+1].f-v[j].f); } } } cout<<ans; }

Compilation message (stderr)

nlo.cpp: In function 'int main()':
nlo.cpp:34:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |         for(ll j=0;j<v.size()-1;j++) {
      |                    ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...