Submission #205401

#TimeUsernameProblemLanguageResultExecution timeMemory
205401okoWall (IOI14_wall)C++14
0 / 100
631 ms34808 KiB
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include "wall.h" #include<bits/stdc++.h> using namespace std; vector<int>mx[100005],mn[100005]; void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]) { for(int i=0;i<k;i++) { int l=left[i],r=right[i],h=height[i]; if(op[i]==1) { mx[l].push_back(h); mx[r+1].push_back(-h); } else { mn[l].push_back(h); mn[r+1].push_back(-h); } } multiset<int>ms; ms.insert(0); for(int i=0;i<n;i++) { for(int j=0;j<mx[i].size();j++) { int x=mx[i][j]; if(x>0)ms.insert(x); else ms.erase(ms.lower_bound(-x)); } finalHeight[i]=*--ms.end(); } ms.clear(); for(int i=0;i<n;i++) { for(int j=0;j<mn[i].size();j++) { int x=mn[i][j]; if(x>0)ms.insert(-x); else ms.erase(ms.lower_bound(x)); } if(ms.size()==0)continue; int z=*ms.begin(); finalHeight[i]=min(finalHeight[i],z); } }

Compilation message (stderr)

wall.cpp: In function 'void buildWall(int, int, int*, int*, int*, int*, int*)':
wall.cpp:28:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j=0;j<mx[i].size();j++)
                     ~^~~~~~~~~~~~~
wall.cpp:39:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j=0;j<mn[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...