이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "wall.h"
#define ll long long
#define f first
#define s second
using namespace std;
const int maxn=2e6+5;
int N,Q;
vector<pair<int,int>> sta[maxn];
int resavaj(vector<pair<int,int>> V){
int maxa=0,minr=1e9,v1=0,v2=0;
for(int i=0;i<V.size();i++)
if(V[i].f==1)
v2=max(v2,V[i].s);
for(int i=0;i<V.size();i++){
if(V[i].f==1)
maxa=max(maxa,V[i].s);
else{
if(V[i].s<=maxa)
v2=min(v2,V[i].s);
}
}
for(int i=V.size()-1;i>=0;i--){
if(V[i].f==2)
minr=min(minr,V[i].s);
else
if(V[i].s<=minr)
v1=max(v1,V[i].s);
}
// cout<<v1<<" "<<v2<<endl;
return max(v1,v2);
}
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
N=n;
Q=k;
for(int i=0;i<Q;i++){
for(int j=left[i];j<=right[i];j++)
sta[j].push_back({op[i],height[i]});
}
for(int i=0;i<N;i++)
finalHeight[i]=resavaj(sta[i]);
}
컴파일 시 표준 에러 (stderr) 메시지
wall.cpp: In function 'int resavaj(std::vector<std::pair<int, int> >)':
wall.cpp:12:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
12 | for(int i=0;i<V.size();i++)
| ~^~~~~~~~~
wall.cpp:15:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
15 | for(int i=0;i<V.size();i++){
| ~^~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |