Submission #205403

# Submission time Handle Problem Language Result Execution time Memory
205403 2020-02-28T20:05:19 Z oko Wall (IOI14_wall) C++14
0 / 100
1006 ms 34916 KB
#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;
    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));
        }
        if(ms.size()==0)continue;
        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

wall.cpp: In function 'void buildWall(int, int, int*, int*, int*, int*, int*)':
wall.cpp:27: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 time Memory Grader output
1 Correct 8 ms 4984 KB Output is correct
2 Incorrect 10 ms 5240 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 4984 KB Output is correct
2 Correct 620 ms 34916 KB Output is correct
3 Correct 260 ms 15760 KB Output is correct
4 Incorrect 1006 ms 32152 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 4984 KB Output is correct
2 Incorrect 10 ms 5240 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 4984 KB Output is correct
2 Incorrect 13 ms 5240 KB Output isn't correct
3 Halted 0 ms 0 KB -