# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
620891 |
2022-08-03T10:07:12 Z |
balbit |
벽 (IOI14_wall) |
C++14 |
|
756 ms |
124424 KB |
#include "wall.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<ll, ll>
#define f first
#define s second
#define FOR(i,a,b) for (int i = a; i<b; ++i)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define MX(a,b) a = max(a,b)
#define MN(a,b) a = min(a,b)
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
#define pb push_back
#ifdef BALBIT
#define bug(...) cerr<<"#"<<__LINE__<<": "<<#__VA_ARGS__<<"- ", _do(__VA_ARGS__)
template<typename T> void _do(T && x) {cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T && x, S && ...y) {cerr<<x<<", "; _do(y...);}
#else
#define bug(...)
#define endl '\n'
#endif
const ll inf = 0x3f3f3f3f3f3f3f3f;
const int iinf = 0x3f3f3f3f;
const int maxn = 5e5+5;
struct rng{
int l,r;
inline int eval(int x) {
return x<l?l:(x>r?r:x);
}
rng(){
l=0,r=100000;
}
rng(int a, int b):l(a),r(b){}
};
inline rng mrg(rng a, rng b) {
return {b.eval(a.l), b.eval(a.r)};
}
rng seg[maxn*4];
void MO(int p, rng to, int o=1, int l=0, int r=maxn-1) {
if (l > p || r < p) return;
if (l==r) {
seg[o] = to; return;
}
int mid = (l+r)/2;
MO(p,to,o*2,l,mid); MO(p,to,o*2+1,mid+1,r);
seg[o] = mrg(seg[o*2], seg[o*2+1]);
}
vector<pair<int, rng> > work[maxn*4]; //what to do at these positions
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
REP(i,k) {
rng bro = op[i]==1?rng{height[i],100000} : rng{0,height[i]};
work[left[i]].pb({i, bro});
work[right[i]+1].pb({i, rng()});
}
REP(i,n) {
for (auto &e : work[i]) {
MO(e.f, e.s);
}
bug(i, seg[1].l, seg[1].r);
finalHeight[i] = seg[1].l;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
37 ms |
62804 KB |
Output is correct |
2 |
Correct |
52 ms |
63196 KB |
Output is correct |
3 |
Correct |
31 ms |
62996 KB |
Output is correct |
4 |
Correct |
35 ms |
63308 KB |
Output is correct |
5 |
Correct |
33 ms |
63308 KB |
Output is correct |
6 |
Correct |
33 ms |
63276 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
62860 KB |
Output is correct |
2 |
Correct |
312 ms |
82632 KB |
Output is correct |
3 |
Correct |
273 ms |
73980 KB |
Output is correct |
4 |
Correct |
649 ms |
91232 KB |
Output is correct |
5 |
Correct |
451 ms |
88900 KB |
Output is correct |
6 |
Correct |
412 ms |
88116 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
39 ms |
62928 KB |
Output is correct |
2 |
Correct |
35 ms |
63188 KB |
Output is correct |
3 |
Correct |
32 ms |
62940 KB |
Output is correct |
4 |
Correct |
37 ms |
63276 KB |
Output is correct |
5 |
Correct |
35 ms |
63316 KB |
Output is correct |
6 |
Correct |
35 ms |
63276 KB |
Output is correct |
7 |
Correct |
31 ms |
62820 KB |
Output is correct |
8 |
Correct |
298 ms |
82728 KB |
Output is correct |
9 |
Correct |
296 ms |
74040 KB |
Output is correct |
10 |
Correct |
630 ms |
91296 KB |
Output is correct |
11 |
Correct |
403 ms |
89020 KB |
Output is correct |
12 |
Correct |
375 ms |
88096 KB |
Output is correct |
13 |
Correct |
33 ms |
62796 KB |
Output is correct |
14 |
Correct |
320 ms |
82628 KB |
Output is correct |
15 |
Correct |
82 ms |
64716 KB |
Output is correct |
16 |
Correct |
739 ms |
91540 KB |
Output is correct |
17 |
Correct |
439 ms |
87800 KB |
Output is correct |
18 |
Correct |
487 ms |
87284 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
30 ms |
62832 KB |
Output is correct |
2 |
Correct |
33 ms |
63180 KB |
Output is correct |
3 |
Correct |
38 ms |
62932 KB |
Output is correct |
4 |
Correct |
51 ms |
63308 KB |
Output is correct |
5 |
Correct |
50 ms |
63308 KB |
Output is correct |
6 |
Correct |
37 ms |
63256 KB |
Output is correct |
7 |
Correct |
33 ms |
62796 KB |
Output is correct |
8 |
Correct |
280 ms |
82628 KB |
Output is correct |
9 |
Correct |
271 ms |
74040 KB |
Output is correct |
10 |
Correct |
751 ms |
91184 KB |
Output is correct |
11 |
Correct |
452 ms |
89020 KB |
Output is correct |
12 |
Correct |
448 ms |
88096 KB |
Output is correct |
13 |
Correct |
41 ms |
62904 KB |
Output is correct |
14 |
Correct |
360 ms |
82632 KB |
Output is correct |
15 |
Correct |
86 ms |
64708 KB |
Output is correct |
16 |
Correct |
737 ms |
91376 KB |
Output is correct |
17 |
Correct |
454 ms |
87888 KB |
Output is correct |
18 |
Correct |
494 ms |
87272 KB |
Output is correct |
19 |
Correct |
705 ms |
113912 KB |
Output is correct |
20 |
Correct |
734 ms |
121812 KB |
Output is correct |
21 |
Correct |
756 ms |
124424 KB |
Output is correct |
22 |
Correct |
637 ms |
121884 KB |
Output is correct |
23 |
Correct |
673 ms |
121980 KB |
Output is correct |
24 |
Correct |
630 ms |
121832 KB |
Output is correct |
25 |
Correct |
608 ms |
121840 KB |
Output is correct |
26 |
Correct |
638 ms |
124372 KB |
Output is correct |
27 |
Correct |
653 ms |
124412 KB |
Output is correct |
28 |
Correct |
656 ms |
121772 KB |
Output is correct |
29 |
Correct |
638 ms |
121824 KB |
Output is correct |
30 |
Correct |
680 ms |
121764 KB |
Output is correct |