제출 #775559

#제출 시각아이디문제언어결과실행 시간메모리
775559Trumling벽 (IOI14_wall)C++14
24 / 100
208 ms31640 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[idx].F==i)
    {
      pq.push({v[idx].S.F,v[idx].S.S});
      idx++;
    }
   
    while(!pq.empty() && pq.top().S<i)
      pq.pop();
    if(!pq.empty())
    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));
  idx=0;

  for(int i=0;i<n;i++)
  {
    while(idx<v.size() && v[idx].F==i)
    {
      pq.push({-v[idx].S.F,v[idx].S.S});
      idx++;
    }

    while(!pq.empty() && pq.top().S<i)
      pq.pop();

    if(!pq.empty())
    finalHeight[i]=min(-pq.top().F,finalHeight[i]);
  }
  
  return; 
}

컴파일 시 표준 에러 (stderr) 메시지

wall.cpp: In function 'void buildWall(int, int, int*, int*, int*, int*, int*)':
wall.cpp:31: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]
   31 |     while(idx<v.size() && v[idx].F==i)
      |           ~~~^~~~~~~~~
wall.cpp:61: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]
   61 |     while(idx<v.size() && v[idx].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...