Submission #775546

#TimeUsernameProblemLanguageResultExecution timeMemory
775546TrumlingWall (IOI14_wall)C++14
0 / 100
1 ms244 KiB
#include "wall.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back #define F first #define S second #define enter cout<<'\n'; #define INF 99999999999999999 #define MOD 1000000007 #define all(x) x.begin(),x.end() void buildWall(int n, int k, int op[], int left[], int right[], int height[], int *finalHeight){ vector<pair<int,pair<int,int>>>v; for(int i=0;i<k;i++) { if(op[i]==2) break; v.pb({left[i],{height[i],right[i]}}); } sort(all(v)); ll idx=0; priority_queue<pair<int,int>>pq; for(int i=0;i<n;i++) { while(idx<v.size() && v[i].F==i) { pq.push({v[idx].S.F,v[idx].S.S}); idx++; } while(!pq.empty() && pq.top().S<i) pq.pop(); finalHeight[i]=pq.top().F; } while(!pq.empty()) pq.pop(); v.clear(); for(int i=0;i<k;i++) { if(op[i]==1) continue; v.pb({left[i],{height[i],right[i]}}); } sort(all(v)); for(int i=0;i<n;i++) { while(idx<v.size() && v[i].F==i) { pq.push({-v[idx].S.F,v[idx].S.S}); idx++; } while(!pq.empty() && pq.top().S<i) pq.pop(); finalHeight[i]=min(-pq.top().F,finalHeight[i]); } return; }

Compilation message (stderr)

wall.cpp: In function 'void buildWall(int, int, int*, int*, int*, int*, int*)':
wall.cpp:28:14: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<std::pair<int, std::pair<int, int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     while(idx<v.size() && v[i].F==i)
      |           ~~~^~~~~~~~~
wall.cpp:54:14: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<std::pair<int, std::pair<int, int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |     while(idx<v.size() && v[i].F==i)
      |           ~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...