Submission #838490

#TimeUsernameProblemLanguageResultExecution timeMemory
838490AndreyWall (IOI14_wall)C++14
0 / 100
431 ms85204 KiB
#include "wall.h" #include<bits/stdc++.h> using namespace std; vector<pair<int,int>> seg(3000000,{0,INT_MAX}); vector<pair<pair<int,int>,int>> haha[1000000]; void upd(int l, int r, int x, int p, int y, int a) { if(l == r) { if(y == 0) { seg[x] = {a,seg[x].second}; } else { seg[x] = {seg[x].first,a}; } return; } int m = (l+r)/2; if(p <= m) { upd(l,m,x*2+1,p,y,a); } else { upd(m+1,r,x*2+2,p,y,a); } if(seg[x*2+2].first >= seg[x*2+1].second) { seg[x] = seg[x*2+2]; } else { seg[x] = {max(seg[x*2+1].first,seg[x*2+2].first),min(seg[x*2+1].second,seg[x*2+2].second)}; } } void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){ for(int i = 0; i < k; i++) { haha[left[i]].push_back({{i,op[i]-1},height[i]}); int c = 0; if(op[i] == 2) { c = INT_MAX; } haha[right[i]+1].push_back({{i,op[i]-1},c}); } for(int i = 0; i < n; i++) { for(int j = 0; j < haha[i].size(); j++) { upd(0,k-1,0,haha[i][j].first.first,haha[i][j].first.second,haha[i][j].second); } finalHeight[i] = min(seg[0].first,seg[0].second); } }

Compilation message (stderr)

wall.cpp: In function 'void buildWall(int, int, int*, int*, int*, int*, int*)':
wall.cpp:43:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<std::pair<int, int>, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |         for(int j = 0; j < haha[i].size(); j++) {
      |                        ~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...