답안 #627357

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
627357 2022-08-12T13:42:04 Z ainta 송신탑 (IOI22_towers) C++17
100 / 100
1837 ms 52756 KB
#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
 
#define rng(i,a,b) for(int i=int(a);i<=int(b);i++)
#define rep(i,b) rng(i,0,b-1)
#define gnr(i,b,a) for(int i=int(b);i>=int(a);i--)
#define per(i,b) gnr(i,b-1,0)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define si(x) int(x.size())
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using pii=pair<int,int>;
using vi=vc<int>;
using uint=unsigned;
using ull=unsigned ll;
using pil=pair<int,ll>;
using pli=pair<ll,int>;
using pll=pair<ll,ll>;
using t3=tuple<int,int,int>;
#define N_ 101000
#define SZ 131072

int chk, w[N_], n, INF = 1e9 + 123;
//vi V;

struct Tree{
  pii IT[SZ+SZ];
  void Put(int a, int b){
    IT[a+SZ]={b,a};
    a+=SZ;
    while(a!=1){
      a>>=1;
      IT[a]=max(IT[a*2],IT[a*2+1]);
    }
  }
  pii Get(int b, int e){
    pii r={-INF,0};
    b+=SZ,e+=SZ;
    while(b<=e){
      r=max({r,IT[b],IT[e]});
      b=(b+1)>>1,e=(e-1)>>1;
    }
    return r;
  }
}T1,T2,U1,U2;

pii Max(int b, int e){
  return T1.Get(b,e);
}
pii Min(int b, int e){
  auto z = T2.Get(b,e);
  return {-z.fi, z.se};
}

struct Node{
  pii Mn, Mx;
  t3 ud, du;
}IT[SZ+SZ];
Node Merge (Node a, Node b){
  Node r;
  r.Mn = min(a.Mn,b.Mn);
  r.Mx = max(a.Mx,b.Mx);
  r.ud = max({a.ud, b.ud, {a.Mx.fi - b.Mn.fi, a.Mx.se, b.Mn.se} });
  r.du = max({a.du, b.du, {b.Mx.fi - a.Mn.fi, a.Mn.se, b.Mx.se} });
  return r;
}

void Put(int a){
  Node t = {{w[a],a}, {w[a],a}, {0,a,a}, {0,a,a}};
  a+=SZ;
  IT[a] = t;
  while(a!=1){
    a>>=1;
    IT[a] = Merge(IT[a*2],IT[a*2+1]);
  }
}
Node GetRange(int b, int e){
  b+=SZ,e+=SZ;
  vi TL, TR;
  while(b<=e){
    if(b&1)TL.pb(b);
    if(!(e&1))TR.pb(e);
    b=(b+1)>>1,e=(e-1)>>1;
  }
  reverse(all(TR));
  for(auto &t : TR)TL.pb(t);
  Node res = IT[TL[0]];
  rng(i,1,si(TL)-1){
    res = Merge(res, IT[TL[i]]);
  }
  return res;
}

int U[N_];
int isUp[N_];

priority_queue<t3>PQ;
set<int>Set;
void SetPut(int x, int d){
  auto it = Set.find(x);
  auto it2 = it;
  auto it3 = it;
  it2--;
  it3++;

  if(*it2 == 0){
    if(x>1){
      if(isUp[x]){
        auto [gg,u] = Min(1,x-1);
        if(w[x] > w[u]){
          PQ.push({w[x]-w[u], 0, u});
        }
      }
      else{
        auto [gg,u] = Max(1,x-1);
        if(w[x] < w[u]){
          PQ.push({w[u]-w[x], 0, u});
          isUp[u] = 1;
        }
      }
    }
  }
  else{
    int b = (*it2) + 1, e = (*it)-1;

    if(b<=e){
      if(isUp[x]){
        auto [p1,p2,p3,p4] = GetRange(b,e);
        if(get<0>(p3)>0){
          PQ.push(p3);
          isUp[get<1>(p3)] = 1;
        }
      }
      else{
        auto [p1,p2,p3,p4] = GetRange(b,e);
        if(get<0>(p4)>0){
          PQ.push(p4);
          isUp[get<2>(p4)] = 1;
        }
      }
    }
  }
  if(*it3 == n+1){
    if(x<n){
      if(isUp[x]){
        auto [gg,u] = Min(x+1,n);
        if(w[x] > w[u]){
          PQ.push({w[x]-w[u], 0, u});
        }
      }
      else{
        auto [gg,u] = Max(x+1,n);
        if(w[x] < w[u]){
          PQ.push({w[u]-w[x], 0, u});
          isUp[u] = 1;
        }
      }
    }

  }
  else{
    int b = (*it) + 1, e = (*it3)-1;

    if(b<=e){
      if(!isUp[x]){
        auto [p1,p2,p3,p4] = GetRange(b,e);
        if(get<0>(p3)>0){
          PQ.push(p3);
          isUp[get<1>(p3)] = 1;
        }
      }
      else{
        auto [p1,p2,p3,p4] = GetRange(b,e);
        if(get<0>(p4)>0){
          PQ.push(p4);
          isUp[get<2>(p4)] = 1;
        }
      }
    }
  }
}

int Root[N_];
struct PNode{
  int l, r, s;
};
PNode PST[N_*30];
int cnt;

void Add(int nd, int p, int l, int r, int x){
  PST[nd] = PST[p];
  int m = (l+r)>>1;
  PST[nd].s++;
  if(l==r)return;
  if(x<=m){
    PST[nd].l = ++cnt;
    Add(PST[nd].l, PST[p].l, l, m, x);
  }
  else{
    PST[nd].r = ++cnt;
    Add(PST[nd].r, PST[p].r, m+1, r, x);
  }
}

int Sum(int nd, int b, int e, int s, int l){
  if(s<=b&&e<=l)return PST[nd].s;
  if(s>l)return 0;
  int m = (b+e)>>1;
  int rr = 0;
  if(s<=m)rr += Sum(PST[nd].l, b, m, s, l);
  if(l>m) rr += Sum(PST[nd].r, m+1, e, s, l);
  return rr;
}


int Left(int nd, int b, int e, int s, int l){
  if(!PST[nd].s)return -1;
  if(b==e)return b;
  int m = (b+e)>>1;
  int rr = 0;
  if(s<=m){
    rr = Left(PST[nd].l, b, m, s, l);
    if(rr!=-1)return rr;
  }
  return Left(PST[nd].r, m+1, e, s, l);
}
int Right(int nd, int b, int e, int s, int l){
  if(!PST[nd].s)return -1;
  if(b==e)return b;
  int m = (b+e)>>1;
  int rr = 0;
  if(l>m){
    rr = Right(PST[nd].r, m+1, e, s, l);
    if(rr!=-1)return rr;
  }
  return Right(PST[nd].l, b, m, s, l);
}

vc<pii>V;

void init(int N, std::vector<int> H) {
  n = N;
  rng(i,1,N){
    w[i] = H[i-1];
    T1.Put(i,w[i]);
    T2.Put(i,-w[i]);
  }
  rng(i,1,n){
    Put(i);
  }
  auto [p1, p2, p3, p4] = GetRange(1,n);
  Set.insert(0);
  Set.insert(n+1);
  {
    if(get<0>(p3) < get<0>(p4)){
      PQ.push(p4);
      isUp[get<2>(p4)] = 1;
    }
    else{
      PQ.push(p3);
      isUp[get<1>(p3)] = 1;
    }
  }
  while(!PQ.empty()){
    
    auto [d,l,r] = PQ.top();
    //printf("! %d %d %d\n",d,l,r);
    PQ.pop();
    if(l!=0){
      Set.insert(l);
      if(!U[l])U[l] = d;
    }
    Set.insert(r);
    if(!U[r])U[r] = d;
    if(l)SetPut(l,d);
    SetPut(r,d);
  }
  rng(i,1,n){
    V.pb({U[i],i});
    U1.Put(i, U[i]);
  }
  sort(all(V));
  per(i,n){
    Root[i] = ++cnt;
    Add(Root[i], Root[i+1], 1, n, V[i].se);
  }
}


int max_towers(int L, int R, int D) {
  L++,R++;
  int pv = lower_bound(all(V), pii(D,-999)) - V.begin();
  int c = Sum(Root[pv], 1, n, L, R);
  if(!c)return 1;

  int bb = Left(Root[pv], 1, n, L, R);
  int ee = Right(Root[pv], 1, n, L, R);

  if(isUp[bb]){
    if(w[bb] - Min(L,bb-1).fi>= D) c++;
    else c--;
  }
  if(isUp[ee]){
    if(w[ee] - Min(ee+1,R).fi>= D) c++;
    else c--;
  }
  return max(1,(c+1)/2);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 518 ms 21224 KB Output is correct
2 Correct 1010 ms 36128 KB Output is correct
3 Correct 1122 ms 36104 KB Output is correct
4 Correct 798 ms 36148 KB Output is correct
5 Correct 973 ms 36172 KB Output is correct
6 Correct 1098 ms 36176 KB Output is correct
7 Correct 975 ms 36212 KB Output is correct
8 Correct 0 ms 464 KB Output is correct
9 Correct 3 ms 1088 KB Output is correct
10 Correct 2 ms 976 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 592 KB Output is correct
2 Correct 4 ms 1104 KB Output is correct
3 Correct 4 ms 1104 KB Output is correct
4 Correct 7 ms 1188 KB Output is correct
5 Correct 6 ms 1232 KB Output is correct
6 Correct 5 ms 1148 KB Output is correct
7 Correct 6 ms 1232 KB Output is correct
8 Correct 4 ms 1068 KB Output is correct
9 Correct 3 ms 976 KB Output is correct
10 Correct 3 ms 1104 KB Output is correct
11 Correct 3 ms 1104 KB Output is correct
12 Correct 0 ms 464 KB Output is correct
13 Correct 2 ms 1104 KB Output is correct
14 Correct 3 ms 1104 KB Output is correct
15 Correct 4 ms 1104 KB Output is correct
16 Correct 5 ms 1232 KB Output is correct
17 Correct 5 ms 1232 KB Output is correct
18 Correct 2 ms 976 KB Output is correct
19 Correct 2 ms 1104 KB Output is correct
20 Correct 4 ms 1104 KB Output is correct
21 Correct 5 ms 1216 KB Output is correct
22 Correct 5 ms 1232 KB Output is correct
23 Correct 2 ms 976 KB Output is correct
24 Correct 3 ms 1104 KB Output is correct
25 Correct 3 ms 756 KB Output is correct
26 Correct 5 ms 1184 KB Output is correct
27 Correct 6 ms 1156 KB Output is correct
28 Correct 6 ms 1232 KB Output is correct
29 Correct 8 ms 1232 KB Output is correct
30 Correct 6 ms 1232 KB Output is correct
31 Correct 6 ms 1232 KB Output is correct
32 Correct 2 ms 1104 KB Output is correct
33 Correct 3 ms 1088 KB Output is correct
34 Correct 3 ms 1104 KB Output is correct
35 Correct 2 ms 1104 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 592 KB Output is correct
2 Correct 4 ms 1104 KB Output is correct
3 Correct 4 ms 1104 KB Output is correct
4 Correct 7 ms 1188 KB Output is correct
5 Correct 6 ms 1232 KB Output is correct
6 Correct 5 ms 1148 KB Output is correct
7 Correct 6 ms 1232 KB Output is correct
8 Correct 4 ms 1068 KB Output is correct
9 Correct 3 ms 976 KB Output is correct
10 Correct 3 ms 1104 KB Output is correct
11 Correct 3 ms 1104 KB Output is correct
12 Correct 0 ms 464 KB Output is correct
13 Correct 2 ms 1104 KB Output is correct
14 Correct 3 ms 1104 KB Output is correct
15 Correct 4 ms 1104 KB Output is correct
16 Correct 5 ms 1232 KB Output is correct
17 Correct 5 ms 1232 KB Output is correct
18 Correct 2 ms 976 KB Output is correct
19 Correct 2 ms 1104 KB Output is correct
20 Correct 4 ms 1104 KB Output is correct
21 Correct 5 ms 1216 KB Output is correct
22 Correct 5 ms 1232 KB Output is correct
23 Correct 2 ms 976 KB Output is correct
24 Correct 3 ms 1104 KB Output is correct
25 Correct 3 ms 756 KB Output is correct
26 Correct 5 ms 1184 KB Output is correct
27 Correct 6 ms 1156 KB Output is correct
28 Correct 6 ms 1232 KB Output is correct
29 Correct 8 ms 1232 KB Output is correct
30 Correct 6 ms 1232 KB Output is correct
31 Correct 6 ms 1232 KB Output is correct
32 Correct 2 ms 1104 KB Output is correct
33 Correct 3 ms 1088 KB Output is correct
34 Correct 3 ms 1104 KB Output is correct
35 Correct 2 ms 1104 KB Output is correct
36 Correct 223 ms 27252 KB Output is correct
37 Correct 540 ms 44544 KB Output is correct
38 Correct 580 ms 44496 KB Output is correct
39 Correct 428 ms 45248 KB Output is correct
40 Correct 509 ms 46028 KB Output is correct
41 Correct 470 ms 45240 KB Output is correct
42 Correct 522 ms 46116 KB Output is correct
43 Correct 116 ms 36148 KB Output is correct
44 Correct 113 ms 36208 KB Output is correct
45 Correct 122 ms 36136 KB Output is correct
46 Correct 109 ms 36284 KB Output is correct
47 Correct 458 ms 43304 KB Output is correct
48 Correct 642 ms 47396 KB Output is correct
49 Correct 440 ms 45412 KB Output is correct
50 Correct 116 ms 36200 KB Output is correct
51 Correct 117 ms 36240 KB Output is correct
52 Correct 708 ms 46032 KB Output is correct
53 Correct 742 ms 47844 KB Output is correct
54 Correct 465 ms 45484 KB Output is correct
55 Correct 102 ms 36156 KB Output is correct
56 Correct 126 ms 36152 KB Output is correct
57 Correct 386 ms 41536 KB Output is correct
58 Correct 440 ms 43400 KB Output is correct
59 Correct 428 ms 43412 KB Output is correct
60 Correct 503 ms 45864 KB Output is correct
61 Correct 480 ms 45452 KB Output is correct
62 Correct 430 ms 45260 KB Output is correct
63 Correct 1194 ms 52720 KB Output is correct
64 Correct 110 ms 36156 KB Output is correct
65 Correct 105 ms 36112 KB Output is correct
66 Correct 123 ms 36172 KB Output is correct
67 Correct 128 ms 36204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1054 ms 42644 KB Output is correct
2 Correct 1375 ms 42672 KB Output is correct
3 Correct 1165 ms 42932 KB Output is correct
4 Correct 1462 ms 46408 KB Output is correct
5 Correct 1675 ms 48232 KB Output is correct
6 Correct 1785 ms 48672 KB Output is correct
7 Correct 1837 ms 49296 KB Output is correct
8 Correct 986 ms 36212 KB Output is correct
9 Correct 922 ms 36140 KB Output is correct
10 Correct 757 ms 36412 KB Output is correct
11 Correct 1025 ms 36224 KB Output is correct
12 Correct 1037 ms 36136 KB Output is correct
13 Correct 806 ms 36212 KB Output is correct
14 Correct 0 ms 464 KB Output is correct
15 Correct 3 ms 1104 KB Output is correct
16 Correct 2 ms 1104 KB Output is correct
17 Correct 435 ms 43364 KB Output is correct
18 Correct 650 ms 47340 KB Output is correct
19 Correct 466 ms 45384 KB Output is correct
20 Correct 112 ms 36096 KB Output is correct
21 Correct 115 ms 36136 KB Output is correct
22 Correct 696 ms 45892 KB Output is correct
23 Correct 693 ms 47824 KB Output is correct
24 Correct 472 ms 45404 KB Output is correct
25 Correct 111 ms 36192 KB Output is correct
26 Correct 117 ms 36196 KB Output is correct
27 Correct 4 ms 1104 KB Output is correct
28 Correct 5 ms 1232 KB Output is correct
29 Correct 5 ms 1232 KB Output is correct
30 Correct 2 ms 1104 KB Output is correct
31 Correct 2 ms 1104 KB Output is correct
32 Correct 5 ms 1104 KB Output is correct
33 Correct 5 ms 1232 KB Output is correct
34 Correct 5 ms 1232 KB Output is correct
35 Correct 2 ms 976 KB Output is correct
36 Correct 4 ms 1104 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 341 ms 9944 KB Output is correct
2 Correct 1102 ms 42768 KB Output is correct
3 Correct 1404 ms 43440 KB Output is correct
4 Correct 1491 ms 47400 KB Output is correct
5 Correct 1393 ms 45308 KB Output is correct
6 Correct 1423 ms 45752 KB Output is correct
7 Correct 1540 ms 46764 KB Output is correct
8 Correct 809 ms 36100 KB Output is correct
9 Correct 925 ms 36112 KB Output is correct
10 Correct 776 ms 36132 KB Output is correct
11 Correct 785 ms 36176 KB Output is correct
12 Correct 712 ms 45996 KB Output is correct
13 Correct 714 ms 47888 KB Output is correct
14 Correct 528 ms 45564 KB Output is correct
15 Correct 108 ms 36108 KB Output is correct
16 Correct 128 ms 36156 KB Output is correct
17 Correct 370 ms 41456 KB Output is correct
18 Correct 432 ms 43432 KB Output is correct
19 Correct 421 ms 43348 KB Output is correct
20 Correct 516 ms 45996 KB Output is correct
21 Correct 484 ms 45580 KB Output is correct
22 Correct 432 ms 45396 KB Output is correct
23 Correct 1140 ms 52756 KB Output is correct
24 Correct 111 ms 36128 KB Output is correct
25 Correct 107 ms 36188 KB Output is correct
26 Correct 119 ms 36160 KB Output is correct
27 Correct 112 ms 36196 KB Output is correct
28 Correct 4 ms 1104 KB Output is correct
29 Correct 4 ms 1232 KB Output is correct
30 Correct 5 ms 1144 KB Output is correct
31 Correct 3 ms 976 KB Output is correct
32 Correct 2 ms 1104 KB Output is correct
33 Correct 2 ms 720 KB Output is correct
34 Correct 5 ms 1104 KB Output is correct
35 Correct 5 ms 1104 KB Output is correct
36 Correct 4 ms 1232 KB Output is correct
37 Correct 8 ms 1232 KB Output is correct
38 Correct 6 ms 1232 KB Output is correct
39 Correct 5 ms 1232 KB Output is correct
40 Correct 3 ms 1104 KB Output is correct
41 Correct 2 ms 976 KB Output is correct
42 Correct 2 ms 1104 KB Output is correct
43 Correct 2 ms 1104 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 592 KB Output is correct
2 Correct 4 ms 1104 KB Output is correct
3 Correct 4 ms 1104 KB Output is correct
4 Correct 7 ms 1188 KB Output is correct
5 Correct 6 ms 1232 KB Output is correct
6 Correct 5 ms 1148 KB Output is correct
7 Correct 6 ms 1232 KB Output is correct
8 Correct 4 ms 1068 KB Output is correct
9 Correct 3 ms 976 KB Output is correct
10 Correct 3 ms 1104 KB Output is correct
11 Correct 3 ms 1104 KB Output is correct
12 Correct 0 ms 464 KB Output is correct
13 Correct 2 ms 1104 KB Output is correct
14 Correct 3 ms 1104 KB Output is correct
15 Correct 4 ms 1104 KB Output is correct
16 Correct 5 ms 1232 KB Output is correct
17 Correct 5 ms 1232 KB Output is correct
18 Correct 2 ms 976 KB Output is correct
19 Correct 2 ms 1104 KB Output is correct
20 Correct 4 ms 1104 KB Output is correct
21 Correct 5 ms 1216 KB Output is correct
22 Correct 5 ms 1232 KB Output is correct
23 Correct 2 ms 976 KB Output is correct
24 Correct 3 ms 1104 KB Output is correct
25 Correct 3 ms 756 KB Output is correct
26 Correct 5 ms 1184 KB Output is correct
27 Correct 6 ms 1156 KB Output is correct
28 Correct 6 ms 1232 KB Output is correct
29 Correct 8 ms 1232 KB Output is correct
30 Correct 6 ms 1232 KB Output is correct
31 Correct 6 ms 1232 KB Output is correct
32 Correct 2 ms 1104 KB Output is correct
33 Correct 3 ms 1088 KB Output is correct
34 Correct 3 ms 1104 KB Output is correct
35 Correct 2 ms 1104 KB Output is correct
36 Correct 223 ms 27252 KB Output is correct
37 Correct 540 ms 44544 KB Output is correct
38 Correct 580 ms 44496 KB Output is correct
39 Correct 428 ms 45248 KB Output is correct
40 Correct 509 ms 46028 KB Output is correct
41 Correct 470 ms 45240 KB Output is correct
42 Correct 522 ms 46116 KB Output is correct
43 Correct 116 ms 36148 KB Output is correct
44 Correct 113 ms 36208 KB Output is correct
45 Correct 122 ms 36136 KB Output is correct
46 Correct 109 ms 36284 KB Output is correct
47 Correct 458 ms 43304 KB Output is correct
48 Correct 642 ms 47396 KB Output is correct
49 Correct 440 ms 45412 KB Output is correct
50 Correct 116 ms 36200 KB Output is correct
51 Correct 117 ms 36240 KB Output is correct
52 Correct 708 ms 46032 KB Output is correct
53 Correct 742 ms 47844 KB Output is correct
54 Correct 465 ms 45484 KB Output is correct
55 Correct 102 ms 36156 KB Output is correct
56 Correct 126 ms 36152 KB Output is correct
57 Correct 386 ms 41536 KB Output is correct
58 Correct 440 ms 43400 KB Output is correct
59 Correct 428 ms 43412 KB Output is correct
60 Correct 503 ms 45864 KB Output is correct
61 Correct 480 ms 45452 KB Output is correct
62 Correct 430 ms 45260 KB Output is correct
63 Correct 1194 ms 52720 KB Output is correct
64 Correct 110 ms 36156 KB Output is correct
65 Correct 105 ms 36112 KB Output is correct
66 Correct 123 ms 36172 KB Output is correct
67 Correct 128 ms 36204 KB Output is correct
68 Correct 1054 ms 42644 KB Output is correct
69 Correct 1375 ms 42672 KB Output is correct
70 Correct 1165 ms 42932 KB Output is correct
71 Correct 1462 ms 46408 KB Output is correct
72 Correct 1675 ms 48232 KB Output is correct
73 Correct 1785 ms 48672 KB Output is correct
74 Correct 1837 ms 49296 KB Output is correct
75 Correct 986 ms 36212 KB Output is correct
76 Correct 922 ms 36140 KB Output is correct
77 Correct 757 ms 36412 KB Output is correct
78 Correct 1025 ms 36224 KB Output is correct
79 Correct 1037 ms 36136 KB Output is correct
80 Correct 806 ms 36212 KB Output is correct
81 Correct 0 ms 464 KB Output is correct
82 Correct 3 ms 1104 KB Output is correct
83 Correct 2 ms 1104 KB Output is correct
84 Correct 435 ms 43364 KB Output is correct
85 Correct 650 ms 47340 KB Output is correct
86 Correct 466 ms 45384 KB Output is correct
87 Correct 112 ms 36096 KB Output is correct
88 Correct 115 ms 36136 KB Output is correct
89 Correct 696 ms 45892 KB Output is correct
90 Correct 693 ms 47824 KB Output is correct
91 Correct 472 ms 45404 KB Output is correct
92 Correct 111 ms 36192 KB Output is correct
93 Correct 117 ms 36196 KB Output is correct
94 Correct 4 ms 1104 KB Output is correct
95 Correct 5 ms 1232 KB Output is correct
96 Correct 5 ms 1232 KB Output is correct
97 Correct 2 ms 1104 KB Output is correct
98 Correct 2 ms 1104 KB Output is correct
99 Correct 5 ms 1104 KB Output is correct
100 Correct 5 ms 1232 KB Output is correct
101 Correct 5 ms 1232 KB Output is correct
102 Correct 2 ms 976 KB Output is correct
103 Correct 4 ms 1104 KB Output is correct
104 Correct 1201 ms 38352 KB Output is correct
105 Correct 1269 ms 43552 KB Output is correct
106 Correct 1266 ms 42992 KB Output is correct
107 Correct 1812 ms 50264 KB Output is correct
108 Correct 1767 ms 49268 KB Output is correct
109 Correct 1343 ms 45068 KB Output is correct
110 Correct 1367 ms 45344 KB Output is correct
111 Correct 993 ms 36156 KB Output is correct
112 Correct 858 ms 36200 KB Output is correct
113 Correct 817 ms 36148 KB Output is correct
114 Correct 976 ms 36128 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 518 ms 21224 KB Output is correct
2 Correct 1010 ms 36128 KB Output is correct
3 Correct 1122 ms 36104 KB Output is correct
4 Correct 798 ms 36148 KB Output is correct
5 Correct 973 ms 36172 KB Output is correct
6 Correct 1098 ms 36176 KB Output is correct
7 Correct 975 ms 36212 KB Output is correct
8 Correct 0 ms 464 KB Output is correct
9 Correct 3 ms 1088 KB Output is correct
10 Correct 2 ms 976 KB Output is correct
11 Correct 1 ms 592 KB Output is correct
12 Correct 4 ms 1104 KB Output is correct
13 Correct 4 ms 1104 KB Output is correct
14 Correct 7 ms 1188 KB Output is correct
15 Correct 6 ms 1232 KB Output is correct
16 Correct 5 ms 1148 KB Output is correct
17 Correct 6 ms 1232 KB Output is correct
18 Correct 4 ms 1068 KB Output is correct
19 Correct 3 ms 976 KB Output is correct
20 Correct 3 ms 1104 KB Output is correct
21 Correct 3 ms 1104 KB Output is correct
22 Correct 0 ms 464 KB Output is correct
23 Correct 2 ms 1104 KB Output is correct
24 Correct 3 ms 1104 KB Output is correct
25 Correct 4 ms 1104 KB Output is correct
26 Correct 5 ms 1232 KB Output is correct
27 Correct 5 ms 1232 KB Output is correct
28 Correct 2 ms 976 KB Output is correct
29 Correct 2 ms 1104 KB Output is correct
30 Correct 4 ms 1104 KB Output is correct
31 Correct 5 ms 1216 KB Output is correct
32 Correct 5 ms 1232 KB Output is correct
33 Correct 2 ms 976 KB Output is correct
34 Correct 3 ms 1104 KB Output is correct
35 Correct 3 ms 756 KB Output is correct
36 Correct 5 ms 1184 KB Output is correct
37 Correct 6 ms 1156 KB Output is correct
38 Correct 6 ms 1232 KB Output is correct
39 Correct 8 ms 1232 KB Output is correct
40 Correct 6 ms 1232 KB Output is correct
41 Correct 6 ms 1232 KB Output is correct
42 Correct 2 ms 1104 KB Output is correct
43 Correct 3 ms 1088 KB Output is correct
44 Correct 3 ms 1104 KB Output is correct
45 Correct 2 ms 1104 KB Output is correct
46 Correct 223 ms 27252 KB Output is correct
47 Correct 540 ms 44544 KB Output is correct
48 Correct 580 ms 44496 KB Output is correct
49 Correct 428 ms 45248 KB Output is correct
50 Correct 509 ms 46028 KB Output is correct
51 Correct 470 ms 45240 KB Output is correct
52 Correct 522 ms 46116 KB Output is correct
53 Correct 116 ms 36148 KB Output is correct
54 Correct 113 ms 36208 KB Output is correct
55 Correct 122 ms 36136 KB Output is correct
56 Correct 109 ms 36284 KB Output is correct
57 Correct 458 ms 43304 KB Output is correct
58 Correct 642 ms 47396 KB Output is correct
59 Correct 440 ms 45412 KB Output is correct
60 Correct 116 ms 36200 KB Output is correct
61 Correct 117 ms 36240 KB Output is correct
62 Correct 708 ms 46032 KB Output is correct
63 Correct 742 ms 47844 KB Output is correct
64 Correct 465 ms 45484 KB Output is correct
65 Correct 102 ms 36156 KB Output is correct
66 Correct 126 ms 36152 KB Output is correct
67 Correct 386 ms 41536 KB Output is correct
68 Correct 440 ms 43400 KB Output is correct
69 Correct 428 ms 43412 KB Output is correct
70 Correct 503 ms 45864 KB Output is correct
71 Correct 480 ms 45452 KB Output is correct
72 Correct 430 ms 45260 KB Output is correct
73 Correct 1194 ms 52720 KB Output is correct
74 Correct 110 ms 36156 KB Output is correct
75 Correct 105 ms 36112 KB Output is correct
76 Correct 123 ms 36172 KB Output is correct
77 Correct 128 ms 36204 KB Output is correct
78 Correct 1054 ms 42644 KB Output is correct
79 Correct 1375 ms 42672 KB Output is correct
80 Correct 1165 ms 42932 KB Output is correct
81 Correct 1462 ms 46408 KB Output is correct
82 Correct 1675 ms 48232 KB Output is correct
83 Correct 1785 ms 48672 KB Output is correct
84 Correct 1837 ms 49296 KB Output is correct
85 Correct 986 ms 36212 KB Output is correct
86 Correct 922 ms 36140 KB Output is correct
87 Correct 757 ms 36412 KB Output is correct
88 Correct 1025 ms 36224 KB Output is correct
89 Correct 1037 ms 36136 KB Output is correct
90 Correct 806 ms 36212 KB Output is correct
91 Correct 0 ms 464 KB Output is correct
92 Correct 3 ms 1104 KB Output is correct
93 Correct 2 ms 1104 KB Output is correct
94 Correct 435 ms 43364 KB Output is correct
95 Correct 650 ms 47340 KB Output is correct
96 Correct 466 ms 45384 KB Output is correct
97 Correct 112 ms 36096 KB Output is correct
98 Correct 115 ms 36136 KB Output is correct
99 Correct 696 ms 45892 KB Output is correct
100 Correct 693 ms 47824 KB Output is correct
101 Correct 472 ms 45404 KB Output is correct
102 Correct 111 ms 36192 KB Output is correct
103 Correct 117 ms 36196 KB Output is correct
104 Correct 4 ms 1104 KB Output is correct
105 Correct 5 ms 1232 KB Output is correct
106 Correct 5 ms 1232 KB Output is correct
107 Correct 2 ms 1104 KB Output is correct
108 Correct 2 ms 1104 KB Output is correct
109 Correct 5 ms 1104 KB Output is correct
110 Correct 5 ms 1232 KB Output is correct
111 Correct 5 ms 1232 KB Output is correct
112 Correct 2 ms 976 KB Output is correct
113 Correct 4 ms 1104 KB Output is correct
114 Correct 341 ms 9944 KB Output is correct
115 Correct 1102 ms 42768 KB Output is correct
116 Correct 1404 ms 43440 KB Output is correct
117 Correct 1491 ms 47400 KB Output is correct
118 Correct 1393 ms 45308 KB Output is correct
119 Correct 1423 ms 45752 KB Output is correct
120 Correct 1540 ms 46764 KB Output is correct
121 Correct 809 ms 36100 KB Output is correct
122 Correct 925 ms 36112 KB Output is correct
123 Correct 776 ms 36132 KB Output is correct
124 Correct 785 ms 36176 KB Output is correct
125 Correct 712 ms 45996 KB Output is correct
126 Correct 714 ms 47888 KB Output is correct
127 Correct 528 ms 45564 KB Output is correct
128 Correct 108 ms 36108 KB Output is correct
129 Correct 128 ms 36156 KB Output is correct
130 Correct 370 ms 41456 KB Output is correct
131 Correct 432 ms 43432 KB Output is correct
132 Correct 421 ms 43348 KB Output is correct
133 Correct 516 ms 45996 KB Output is correct
134 Correct 484 ms 45580 KB Output is correct
135 Correct 432 ms 45396 KB Output is correct
136 Correct 1140 ms 52756 KB Output is correct
137 Correct 111 ms 36128 KB Output is correct
138 Correct 107 ms 36188 KB Output is correct
139 Correct 119 ms 36160 KB Output is correct
140 Correct 112 ms 36196 KB Output is correct
141 Correct 4 ms 1104 KB Output is correct
142 Correct 4 ms 1232 KB Output is correct
143 Correct 5 ms 1144 KB Output is correct
144 Correct 3 ms 976 KB Output is correct
145 Correct 2 ms 1104 KB Output is correct
146 Correct 2 ms 720 KB Output is correct
147 Correct 5 ms 1104 KB Output is correct
148 Correct 5 ms 1104 KB Output is correct
149 Correct 4 ms 1232 KB Output is correct
150 Correct 8 ms 1232 KB Output is correct
151 Correct 6 ms 1232 KB Output is correct
152 Correct 5 ms 1232 KB Output is correct
153 Correct 3 ms 1104 KB Output is correct
154 Correct 2 ms 976 KB Output is correct
155 Correct 2 ms 1104 KB Output is correct
156 Correct 2 ms 1104 KB Output is correct
157 Correct 1201 ms 38352 KB Output is correct
158 Correct 1269 ms 43552 KB Output is correct
159 Correct 1266 ms 42992 KB Output is correct
160 Correct 1812 ms 50264 KB Output is correct
161 Correct 1767 ms 49268 KB Output is correct
162 Correct 1343 ms 45068 KB Output is correct
163 Correct 1367 ms 45344 KB Output is correct
164 Correct 993 ms 36156 KB Output is correct
165 Correct 858 ms 36200 KB Output is correct
166 Correct 817 ms 36148 KB Output is correct
167 Correct 976 ms 36128 KB Output is correct
168 Correct 1 ms 464 KB Output is correct
169 Correct 723 ms 14452 KB Output is correct
170 Correct 1504 ms 42784 KB Output is correct
171 Correct 1465 ms 43248 KB Output is correct
172 Correct 1645 ms 46784 KB Output is correct
173 Correct 1752 ms 49176 KB Output is correct
174 Correct 1401 ms 45640 KB Output is correct
175 Correct 1676 ms 46676 KB Output is correct
176 Correct 914 ms 36132 KB Output is correct
177 Correct 829 ms 36196 KB Output is correct
178 Correct 854 ms 36284 KB Output is correct
179 Correct 1037 ms 36128 KB Output is correct