제출 #986800

#제출 시각아이디문제언어결과실행 시간메모리
986800vjudge1벽 (IOI14_wall)C++17
0 / 100
111 ms262144 KiB
#pragma once #include "bits/stdc++.h" #define F first #define S second #define ll long long #define pii pair<int,int> const int mxN = (1 << 20); const int mod = 1e9 + 7; const int inf = INT_MAX; using namespace std; struct event{ int ty,op,id,val; }; queue<event>q[mxN]; pii seg[mxN]; int N,s,e; pii combine(pii a,pii b){ pii c; c.F = min(max(b.F,a.F),b.S); c.S = max(min(a.S,b.S),c.F); return c; } void update(int ind,int id,int val){ ind += N; if(id == 1) seg[ind].F = val; else seg[ind].S = val; while(ind /= 2) seg[ind] = combine(seg[ind * 2],seg[ind * 2 + 1]); } void printseg(){ int ex = 1; for(int i = 1;i < N * 2;i++){ cout<<"{ "<<seg[i].F<<" , "; if(seg[i].S == inf) cout<<"inf"; else cout<<seg[i].S; cout<<" } "; if(ex * 2 - 1 == i){ ex *= 2; cout<<'\n'; } } } void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){ return; N = exp2(ceil(log2(n))); for(int i = 1;i <= N * 2;i++){ seg[i] = {0,inf}; } for(int i = 0;i < k;i++){ q[left[i]].push({1,op[i],i,height[i]}); q[right[i] + 1].push({-1,op[i],i,height[i]}); } s = 1,e = n; for(int i = 0;i < n;i++){ while(q[i].size()){ auto u = q[i].front(); q[i].pop(); if(u.ty == -1){ update(u.id,1, 0); update(u.id,2, inf); }else{ if(u.op == 1) update(u.id,1, u.val); else update(u.id,2, u.val); } } finalHeight[i] = seg[1].F + 0; } }

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

wall.cpp:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...