답안 #803034

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
803034 2023-08-02T19:42:25 Z Ronin13 송신탑 (IOI22_towers) C++17
100 / 100
1649 ms 430372 KB
#include "towers.h"
#include <bits/stdc++.h>
#define ll long long 
#define ull unsigned ll
#define f first
#define s second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define epb emplace_back
using namespace std;

struct node{
    int mx, mn;
    int mxpos, mnpos;
    int mxdif[2];
    int sum;
    node *l, *r;
    node(){
      mx = 0, mn = 1e9;
      sum = 0;
      for(int i = 0; i < 2; i++){
        mxdif[i] = 0;
      }
      l = r = nullptr;
    }
    node(node *l, node * r) : l(l), r(r){
      if(l == nullptr && r == nullptr){
        mx = 0;
        mn = 1e9;
        for(int i = 0; i < 2; i++) mxdif[i] = 0;
      }
      if(l == nullptr && r){
        mx = r->mx;
        mn = r->mn;
        mxpos = r->mxpos;
        mnpos = r->mnpos;
        for(int i = 0; i < 2; i++)
          mxdif[i] = r->mxdif[i];
        sum = r->sum;
      }
      if(r == nullptr && l){
        mx = l->mx;
        mn = l->mn;
        mxpos = l->mxpos;
        mnpos = l->mnpos;
        for(int i= 0; i < 2; i++)
        mxdif[i] = l->mxdif[i];
        sum = l->sum;
      }
      if(l && r){
        mx = max(l->mx, r->mx);
        mn = min(l->mn, r->mn);
        mx == l->mx ? mxpos = l->mxpos : mxpos = r->mxpos;
        mn == l->mn ? mnpos = l->mnpos : mnpos = r->mnpos;
        mxdif[0] = max({l->mxdif[0], r->mxdif[0], r->mx - l->mn});
        mxdif[1] = max({l->mxdif[1], r->mxdif[1], l->mx - r->mn});
        sum = l->sum + r->sum;
      }
    }
};

int getfirst(node *v, int l, int r, int st, int fin){
    if(l > fin || r < st || v == nullptr) return -1;
    if(l >= st && r <= fin){
      if(v->sum){
          while(l != r){
              int m = (l + r) / 2;
              if(v->l && v->l->sum) r = m, v = v->l;
              else v = v->r, l = m + 1;
          }
          return l;
      } 
      return -1;
    }
    int m = (l + r) / 2;
    int x = getfirst(v->l, l, m, st, fin);
    if(x > -1) return x;
    return getfirst(v->r, m + 1, r, st, fin);
} 

int getlast(node *v, int l, int r, int st, int fin){
    if(l > fin || r < st || v == nullptr){
      return -1;
    }
    if(l >= st && r <= fin){
      if(v->sum){
          while(l != r){
              int m = (l + r) / 2;
              if(v->r && v->r->sum) v = v->r, l = m + 1;
              else v = v->l, r = m;
          }
          return l;
      } 
      return -1;
    }
    int m = (l + r) / 2;
    int x = getlast(v->r, m + 1, r, st, fin);
    if(x > -1) return x;
    return getlast(v->l, l, m, st, fin);
}

int getfirst1(node * v, int l, int r, int st, int fin, int val){
    if(l > fin || r < st || v == nullptr) return -1;
    if(l >= st && r <= fin){
      if(v->mx >= val){
        while(l != r){
          int m = (l + r) / 2;
          if(v->l && v->l->mx >= val) r = m, v = v->l;
          else l = m +1, v = v->r;
        }
        return l;
      }
      return -1;
    }
    int m = (l + r) / 2;
    int x = getfirst1(v->l, l, m, st, fin, val);
    if(x > -1) return x;
    int y = getfirst1(v->r, m + 1, r, st, fin, val);
    return y;
}

int getlast1(node *v, int l, int r, int st, int fin, int val){
  if(l > fin || r < st || v == nullptr) return -1;
  if(l >= st && r <= fin){
      if(v->mx >= val){
        while(l != r){
          int m = (l + r) / 2;
          if(v->r && v->r->mx >= val) l = m + 1,  v= v->r;
          else r = m, v = v->l;
        }
        return l;
      }
      return -1;
  }
  int m = (l + r) / 2;
  int x = getlast1(v->r, m + 1, r, st, fin, val);
  if(x > -1) return x;
  return getlast1(v->l, l, m, st, fin, val);
}

node *update(node *v, int l, int r, int pos, int val){
    //(l > pos || r < pos) return ;
    if(v == nullptr) v = new node();
    if(l == r){
        node *nw = new node();
        nw->sum = val;
        nw->mx = v->mx; nw->mn = v->mn; nw->mxpos = v->mxpos; nw->mnpos = v->mnpos;
        return nw;
    }

    int m = (l + r) / 2;
    if(pos <= m)
      return new node(update(v->l, l, m, pos, val), v->r);
    return new node(v->l, update(v->r, m + 1, r, pos, val));
}

int getsum(node * v, int l, int r, int st, int fin){
    if(l > fin || r < st || v == nullptr) return 0;
    if(l >= st && r <= fin){
      return v->sum;
    }
    int m = (l + r) / 2;
    return getsum(v->l, l, m, st, fin) + getsum(v->r, m + 1, r, st, fin);
}
node *no;
node *get1(node *v, int l, int r, int st, int fin, int ind){
  if(l > fin || r < st || v == nullptr) 
    return no;
  if(l >= st && r <= fin){
    return v;
  } 
  int m = (l + r) / 2;
  return new node(get1(v->l, l, m, st, fin, ind),
                  get1(v->r, m + 1, r, st, fin, ind));
}

int get_max(node *v, int l, int r, int st, int fin){
    if(l > fin || r < st || v == nullptr) 
    return 0;
  if(l >= st && r <= fin){
    return v->mx;
  } 
  int m = (l + r) / 2;
  return max(get_max(v->l, l, m, st, fin), get_max(v->r, m + 1, r, st, fin));
}

pii get2(node *v, int l, int r, int st, int fin){
    if(l > fin || r < st || v == nullptr) return {1e9, 1e9};
    if(l >= st && r <= fin){
      return {v->mn, v->mnpos};
    }
    int m = (l + r) / 2;
    return min(get2(v->l, l, m, st, fin),
              get2(v->r, m + 1, r, st, fin));
}
const int nmax = 200001;
vector <int> a(nmax);

node *build(int l, int r){
    if(l == r){
        node *v = new node();
        v->mn = v->mx = a[l];
        v->mnpos = v->mxpos = l;
        return v;
   }
   int m = (l + r) / 2;
    return new node(build(l, m), build(m + 1, r));
}

vector <int> pos;
node *root[nmax];
int n;
void init(int N, std::vector<int> H) {
  no = new node();
  no->mx = -1e9, no->mn = 1e9;
  n = N;
    a = H;
    root[0] = build(0, n - 1);
    stack <int> st;
    int l[n], r[n];
    for(int i = 0; i < n; i++){
      while(!st.empty()){
        int v = st.top();
        if(a[v] < a[i]) break;
        else st.pop();
      }
      if(st.empty()) l[i] = -1;
      else l[i] = st.top();
      st.push(i);
    }
    while(!st.empty()) st.pop();
    for(int i = n - 1; i >= 0; i--){
        while(!st.empty()){
          int v = st.top();
          if(a[v] < a[i]) break;
          else st.pop();
        }
        if(st.empty()) r[i] = n;
        else r[i] = st.top();
        st.push(i);
    }
    pos.pb(-1e9);
    vector <pii> vv;
    for(int i = 0; i < n; i++){
     // cout << l[i] << ' ' << r[i] << "\n";
        int o = 1e9;
        if(l[i] != -1) o = min(o, get_max(root[0], 0, n - 1, l[i], i) - a[i]);
        if(r[i] != n) o = min(o, get_max(root[0], 0, n - 1, i, r[i]) - a[i]);
        vv.pb({o, i});
    }
    sort(vv.begin(), vv.end());
    reverse(vv.begin(),vv.end());
    int ind = 1;
    for(int i = 0; i < vv.size(); i++){
    //  cout << root[i]->sum << "\n";
        root[i + 1] = update(root[i], 0, n - 1, vv[i].s, 1);
       // cout << 1;
        pos.pb(-vv[i].f);
    }
    
}

int max_towers(int L, int R, int D) {
  int o = upper_bound(pos.begin(), pos.end(), -D) - pos.begin() - 1;
  //cout << o << ' ';
  int A = getfirst(root[o], 0, n - 1, L, R);
  int B = getlast(root[o], 0, n - 1, L, R);
  //cout << A << ' ' << B << "\n";
  if(A == -1){
      pii t = get2(root[o], 0, n - 1, L, R);
      //cout << t.s << "\n";
      int ans = 1;
      int l = getlast1(root[0], 0, n - 1, L, t.s, a[t.s] + D);
    //  cout << l << ' ';
      if(l > -1 && get1(root[0], 0, n - 1, L, l, 0)->mxdif[0] >= D) ans++;
      int r = getfirst1(root[0], 0, n - 1, t.s, R, a[t.s] + D);
    //  cout << r << '\n';
      if(r > -1&& get1(root[0], 0 , n - 1, r, R, 1)->mxdif[1] >= D) ans++;
      return ans;
  }
  else{
    ll ans = getsum(root[o], 0, n - 1, L, R);
    
    int l = getlast1(root[0], 0, n - 1, L, A, a[A] + D);
   // cout << l << ' ';
    if(l > -1 && get1(root[0], 0, n - 1, L, l, 0)->mxdif[0] >= D) ans++;
    int r = getfirst1(root[0], 0, n - 1, B, R, a[B] + D);
   // cout << l <<' ' << r << "\n";
   // cout << get1(root[0], 0, n - 1, r, R, 1) << "\n";
    if(r > -1 && get1(root[0], 0 , n - 1, r, R, 1)->mxdif[1] >= D) ans++;
    return ans;
  }
  return 0;
}

Compilation message

towers.cpp: In function 'void init(int, std::vector<int>)':
towers.cpp:255:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  255 |     for(int i = 0; i < vv.size(); i++){
      |                    ~~^~~~~~~~~~~
towers.cpp:254:9: warning: unused variable 'ind' [-Wunused-variable]
  254 |     int ind = 1;
      |         ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 436 ms 108496 KB Output is correct
2 Correct 1184 ms 194432 KB Output is correct
3 Correct 1189 ms 192260 KB Output is correct
4 Correct 1195 ms 187092 KB Output is correct
5 Correct 1207 ms 187152 KB Output is correct
6 Correct 1348 ms 310648 KB Output is correct
7 Correct 1384 ms 310604 KB Output is correct
8 Correct 1 ms 1104 KB Output is correct
9 Correct 3 ms 2896 KB Output is correct
10 Correct 3 ms 2896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1360 KB Output is correct
2 Correct 3 ms 2896 KB Output is correct
3 Correct 3 ms 2896 KB Output is correct
4 Correct 3 ms 2896 KB Output is correct
5 Correct 3 ms 2896 KB Output is correct
6 Correct 4 ms 2896 KB Output is correct
7 Correct 4 ms 2896 KB Output is correct
8 Correct 2 ms 2896 KB Output is correct
9 Correct 2 ms 2896 KB Output is correct
10 Correct 3 ms 2896 KB Output is correct
11 Correct 3 ms 2896 KB Output is correct
12 Correct 1 ms 1104 KB Output is correct
13 Correct 3 ms 2896 KB Output is correct
14 Correct 2 ms 2896 KB Output is correct
15 Correct 3 ms 2896 KB Output is correct
16 Correct 3 ms 2896 KB Output is correct
17 Correct 3 ms 2896 KB Output is correct
18 Correct 2 ms 2896 KB Output is correct
19 Correct 2 ms 2896 KB Output is correct
20 Correct 3 ms 2896 KB Output is correct
21 Correct 4 ms 2896 KB Output is correct
22 Correct 3 ms 2896 KB Output is correct
23 Correct 2 ms 2896 KB Output is correct
24 Correct 3 ms 2876 KB Output is correct
25 Correct 2 ms 1744 KB Output is correct
26 Correct 3 ms 2896 KB Output is correct
27 Correct 3 ms 2896 KB Output is correct
28 Correct 3 ms 2888 KB Output is correct
29 Correct 3 ms 2896 KB Output is correct
30 Correct 4 ms 2896 KB Output is correct
31 Correct 3 ms 2896 KB Output is correct
32 Correct 2 ms 2896 KB Output is correct
33 Correct 2 ms 2896 KB Output is correct
34 Correct 2 ms 2896 KB Output is correct
35 Correct 4 ms 2896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1360 KB Output is correct
2 Correct 3 ms 2896 KB Output is correct
3 Correct 3 ms 2896 KB Output is correct
4 Correct 3 ms 2896 KB Output is correct
5 Correct 3 ms 2896 KB Output is correct
6 Correct 4 ms 2896 KB Output is correct
7 Correct 4 ms 2896 KB Output is correct
8 Correct 2 ms 2896 KB Output is correct
9 Correct 2 ms 2896 KB Output is correct
10 Correct 3 ms 2896 KB Output is correct
11 Correct 3 ms 2896 KB Output is correct
12 Correct 1 ms 1104 KB Output is correct
13 Correct 3 ms 2896 KB Output is correct
14 Correct 2 ms 2896 KB Output is correct
15 Correct 3 ms 2896 KB Output is correct
16 Correct 3 ms 2896 KB Output is correct
17 Correct 3 ms 2896 KB Output is correct
18 Correct 2 ms 2896 KB Output is correct
19 Correct 2 ms 2896 KB Output is correct
20 Correct 3 ms 2896 KB Output is correct
21 Correct 4 ms 2896 KB Output is correct
22 Correct 3 ms 2896 KB Output is correct
23 Correct 2 ms 2896 KB Output is correct
24 Correct 3 ms 2876 KB Output is correct
25 Correct 2 ms 1744 KB Output is correct
26 Correct 3 ms 2896 KB Output is correct
27 Correct 3 ms 2896 KB Output is correct
28 Correct 3 ms 2888 KB Output is correct
29 Correct 3 ms 2896 KB Output is correct
30 Correct 4 ms 2896 KB Output is correct
31 Correct 3 ms 2896 KB Output is correct
32 Correct 2 ms 2896 KB Output is correct
33 Correct 2 ms 2896 KB Output is correct
34 Correct 2 ms 2896 KB Output is correct
35 Correct 4 ms 2896 KB Output is correct
36 Correct 112 ms 80708 KB Output is correct
37 Correct 173 ms 127852 KB Output is correct
38 Correct 193 ms 127868 KB Output is correct
39 Correct 201 ms 127896 KB Output is correct
40 Correct 228 ms 127900 KB Output is correct
41 Correct 198 ms 127928 KB Output is correct
42 Correct 188 ms 127900 KB Output is correct
43 Correct 126 ms 127864 KB Output is correct
44 Correct 115 ms 128200 KB Output is correct
45 Correct 141 ms 127976 KB Output is correct
46 Correct 130 ms 128144 KB Output is correct
47 Correct 171 ms 127880 KB Output is correct
48 Correct 209 ms 127888 KB Output is correct
49 Correct 201 ms 127812 KB Output is correct
50 Correct 119 ms 128204 KB Output is correct
51 Correct 132 ms 127900 KB Output is correct
52 Correct 182 ms 127808 KB Output is correct
53 Correct 184 ms 127848 KB Output is correct
54 Correct 187 ms 127828 KB Output is correct
55 Correct 126 ms 128432 KB Output is correct
56 Correct 154 ms 127816 KB Output is correct
57 Correct 179 ms 123220 KB Output is correct
58 Correct 171 ms 127868 KB Output is correct
59 Correct 173 ms 127904 KB Output is correct
60 Correct 189 ms 127812 KB Output is correct
61 Correct 186 ms 127808 KB Output is correct
62 Correct 185 ms 127824 KB Output is correct
63 Correct 194 ms 127868 KB Output is correct
64 Correct 119 ms 127820 KB Output is correct
65 Correct 121 ms 128320 KB Output is correct
66 Correct 146 ms 127896 KB Output is correct
67 Correct 137 ms 128204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1098 ms 235048 KB Output is correct
2 Correct 1396 ms 269708 KB Output is correct
3 Correct 1510 ms 269284 KB Output is correct
4 Correct 1383 ms 230860 KB Output is correct
5 Correct 1194 ms 231112 KB Output is correct
6 Correct 1256 ms 231208 KB Output is correct
7 Correct 1514 ms 231160 KB Output is correct
8 Correct 1499 ms 310644 KB Output is correct
9 Correct 1352 ms 310592 KB Output is correct
10 Correct 1553 ms 430372 KB Output is correct
11 Correct 1416 ms 423660 KB Output is correct
12 Correct 1170 ms 310728 KB Output is correct
13 Correct 1428 ms 310712 KB Output is correct
14 Correct 1 ms 1104 KB Output is correct
15 Correct 3 ms 2896 KB Output is correct
16 Correct 2 ms 2896 KB Output is correct
17 Correct 198 ms 127840 KB Output is correct
18 Correct 209 ms 127800 KB Output is correct
19 Correct 194 ms 127788 KB Output is correct
20 Correct 132 ms 128312 KB Output is correct
21 Correct 129 ms 127836 KB Output is correct
22 Correct 186 ms 127844 KB Output is correct
23 Correct 208 ms 127860 KB Output is correct
24 Correct 190 ms 127936 KB Output is correct
25 Correct 130 ms 128248 KB Output is correct
26 Correct 144 ms 127832 KB Output is correct
27 Correct 3 ms 2852 KB Output is correct
28 Correct 3 ms 2828 KB Output is correct
29 Correct 3 ms 2896 KB Output is correct
30 Correct 3 ms 2896 KB Output is correct
31 Correct 2 ms 2896 KB Output is correct
32 Correct 4 ms 2896 KB Output is correct
33 Correct 3 ms 2896 KB Output is correct
34 Correct 3 ms 2896 KB Output is correct
35 Correct 2 ms 2896 KB Output is correct
36 Correct 2 ms 2896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 303 ms 47112 KB Output is correct
2 Correct 1109 ms 207196 KB Output is correct
3 Correct 1215 ms 212512 KB Output is correct
4 Correct 1128 ms 224208 KB Output is correct
5 Correct 1134 ms 202344 KB Output is correct
6 Correct 1132 ms 242768 KB Output is correct
7 Correct 880 ms 224100 KB Output is correct
8 Correct 909 ms 225004 KB Output is correct
9 Correct 995 ms 224940 KB Output is correct
10 Correct 880 ms 224324 KB Output is correct
11 Correct 965 ms 231340 KB Output is correct
12 Correct 192 ms 127824 KB Output is correct
13 Correct 193 ms 127812 KB Output is correct
14 Correct 190 ms 127832 KB Output is correct
15 Correct 130 ms 128292 KB Output is correct
16 Correct 143 ms 127800 KB Output is correct
17 Correct 171 ms 123296 KB Output is correct
18 Correct 183 ms 127868 KB Output is correct
19 Correct 184 ms 127948 KB Output is correct
20 Correct 190 ms 127844 KB Output is correct
21 Correct 190 ms 127852 KB Output is correct
22 Correct 197 ms 127948 KB Output is correct
23 Correct 196 ms 127852 KB Output is correct
24 Correct 124 ms 127820 KB Output is correct
25 Correct 125 ms 128216 KB Output is correct
26 Correct 146 ms 127928 KB Output is correct
27 Correct 141 ms 128196 KB Output is correct
28 Correct 3 ms 2896 KB Output is correct
29 Correct 3 ms 2896 KB Output is correct
30 Correct 3 ms 2860 KB Output is correct
31 Correct 2 ms 2824 KB Output is correct
32 Correct 3 ms 2816 KB Output is correct
33 Correct 1 ms 1744 KB Output is correct
34 Correct 3 ms 2896 KB Output is correct
35 Correct 3 ms 2896 KB Output is correct
36 Correct 3 ms 2896 KB Output is correct
37 Correct 3 ms 2896 KB Output is correct
38 Correct 3 ms 2896 KB Output is correct
39 Correct 3 ms 2896 KB Output is correct
40 Correct 2 ms 2896 KB Output is correct
41 Correct 2 ms 2896 KB Output is correct
42 Correct 2 ms 2896 KB Output is correct
43 Correct 3 ms 2896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1360 KB Output is correct
2 Correct 3 ms 2896 KB Output is correct
3 Correct 3 ms 2896 KB Output is correct
4 Correct 3 ms 2896 KB Output is correct
5 Correct 3 ms 2896 KB Output is correct
6 Correct 4 ms 2896 KB Output is correct
7 Correct 4 ms 2896 KB Output is correct
8 Correct 2 ms 2896 KB Output is correct
9 Correct 2 ms 2896 KB Output is correct
10 Correct 3 ms 2896 KB Output is correct
11 Correct 3 ms 2896 KB Output is correct
12 Correct 1 ms 1104 KB Output is correct
13 Correct 3 ms 2896 KB Output is correct
14 Correct 2 ms 2896 KB Output is correct
15 Correct 3 ms 2896 KB Output is correct
16 Correct 3 ms 2896 KB Output is correct
17 Correct 3 ms 2896 KB Output is correct
18 Correct 2 ms 2896 KB Output is correct
19 Correct 2 ms 2896 KB Output is correct
20 Correct 3 ms 2896 KB Output is correct
21 Correct 4 ms 2896 KB Output is correct
22 Correct 3 ms 2896 KB Output is correct
23 Correct 2 ms 2896 KB Output is correct
24 Correct 3 ms 2876 KB Output is correct
25 Correct 2 ms 1744 KB Output is correct
26 Correct 3 ms 2896 KB Output is correct
27 Correct 3 ms 2896 KB Output is correct
28 Correct 3 ms 2888 KB Output is correct
29 Correct 3 ms 2896 KB Output is correct
30 Correct 4 ms 2896 KB Output is correct
31 Correct 3 ms 2896 KB Output is correct
32 Correct 2 ms 2896 KB Output is correct
33 Correct 2 ms 2896 KB Output is correct
34 Correct 2 ms 2896 KB Output is correct
35 Correct 4 ms 2896 KB Output is correct
36 Correct 112 ms 80708 KB Output is correct
37 Correct 173 ms 127852 KB Output is correct
38 Correct 193 ms 127868 KB Output is correct
39 Correct 201 ms 127896 KB Output is correct
40 Correct 228 ms 127900 KB Output is correct
41 Correct 198 ms 127928 KB Output is correct
42 Correct 188 ms 127900 KB Output is correct
43 Correct 126 ms 127864 KB Output is correct
44 Correct 115 ms 128200 KB Output is correct
45 Correct 141 ms 127976 KB Output is correct
46 Correct 130 ms 128144 KB Output is correct
47 Correct 171 ms 127880 KB Output is correct
48 Correct 209 ms 127888 KB Output is correct
49 Correct 201 ms 127812 KB Output is correct
50 Correct 119 ms 128204 KB Output is correct
51 Correct 132 ms 127900 KB Output is correct
52 Correct 182 ms 127808 KB Output is correct
53 Correct 184 ms 127848 KB Output is correct
54 Correct 187 ms 127828 KB Output is correct
55 Correct 126 ms 128432 KB Output is correct
56 Correct 154 ms 127816 KB Output is correct
57 Correct 179 ms 123220 KB Output is correct
58 Correct 171 ms 127868 KB Output is correct
59 Correct 173 ms 127904 KB Output is correct
60 Correct 189 ms 127812 KB Output is correct
61 Correct 186 ms 127808 KB Output is correct
62 Correct 185 ms 127824 KB Output is correct
63 Correct 194 ms 127868 KB Output is correct
64 Correct 119 ms 127820 KB Output is correct
65 Correct 121 ms 128320 KB Output is correct
66 Correct 146 ms 127896 KB Output is correct
67 Correct 137 ms 128204 KB Output is correct
68 Correct 1098 ms 235048 KB Output is correct
69 Correct 1396 ms 269708 KB Output is correct
70 Correct 1510 ms 269284 KB Output is correct
71 Correct 1383 ms 230860 KB Output is correct
72 Correct 1194 ms 231112 KB Output is correct
73 Correct 1256 ms 231208 KB Output is correct
74 Correct 1514 ms 231160 KB Output is correct
75 Correct 1499 ms 310644 KB Output is correct
76 Correct 1352 ms 310592 KB Output is correct
77 Correct 1553 ms 430372 KB Output is correct
78 Correct 1416 ms 423660 KB Output is correct
79 Correct 1170 ms 310728 KB Output is correct
80 Correct 1428 ms 310712 KB Output is correct
81 Correct 1 ms 1104 KB Output is correct
82 Correct 3 ms 2896 KB Output is correct
83 Correct 2 ms 2896 KB Output is correct
84 Correct 198 ms 127840 KB Output is correct
85 Correct 209 ms 127800 KB Output is correct
86 Correct 194 ms 127788 KB Output is correct
87 Correct 132 ms 128312 KB Output is correct
88 Correct 129 ms 127836 KB Output is correct
89 Correct 186 ms 127844 KB Output is correct
90 Correct 208 ms 127860 KB Output is correct
91 Correct 190 ms 127936 KB Output is correct
92 Correct 130 ms 128248 KB Output is correct
93 Correct 144 ms 127832 KB Output is correct
94 Correct 3 ms 2852 KB Output is correct
95 Correct 3 ms 2828 KB Output is correct
96 Correct 3 ms 2896 KB Output is correct
97 Correct 3 ms 2896 KB Output is correct
98 Correct 2 ms 2896 KB Output is correct
99 Correct 4 ms 2896 KB Output is correct
100 Correct 3 ms 2896 KB Output is correct
101 Correct 3 ms 2896 KB Output is correct
102 Correct 2 ms 2896 KB Output is correct
103 Correct 2 ms 2896 KB Output is correct
104 Correct 1125 ms 233712 KB Output is correct
105 Correct 1271 ms 271592 KB Output is correct
106 Correct 1309 ms 276068 KB Output is correct
107 Correct 1326 ms 264308 KB Output is correct
108 Correct 1343 ms 288684 KB Output is correct
109 Correct 1328 ms 267652 KB Output is correct
110 Correct 1375 ms 231656 KB Output is correct
111 Correct 1063 ms 201180 KB Output is correct
112 Correct 1054 ms 169616 KB Output is correct
113 Correct 1155 ms 230512 KB Output is correct
114 Correct 1204 ms 298600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 436 ms 108496 KB Output is correct
2 Correct 1184 ms 194432 KB Output is correct
3 Correct 1189 ms 192260 KB Output is correct
4 Correct 1195 ms 187092 KB Output is correct
5 Correct 1207 ms 187152 KB Output is correct
6 Correct 1348 ms 310648 KB Output is correct
7 Correct 1384 ms 310604 KB Output is correct
8 Correct 1 ms 1104 KB Output is correct
9 Correct 3 ms 2896 KB Output is correct
10 Correct 3 ms 2896 KB Output is correct
11 Correct 1 ms 1360 KB Output is correct
12 Correct 3 ms 2896 KB Output is correct
13 Correct 3 ms 2896 KB Output is correct
14 Correct 3 ms 2896 KB Output is correct
15 Correct 3 ms 2896 KB Output is correct
16 Correct 4 ms 2896 KB Output is correct
17 Correct 4 ms 2896 KB Output is correct
18 Correct 2 ms 2896 KB Output is correct
19 Correct 2 ms 2896 KB Output is correct
20 Correct 3 ms 2896 KB Output is correct
21 Correct 3 ms 2896 KB Output is correct
22 Correct 1 ms 1104 KB Output is correct
23 Correct 3 ms 2896 KB Output is correct
24 Correct 2 ms 2896 KB Output is correct
25 Correct 3 ms 2896 KB Output is correct
26 Correct 3 ms 2896 KB Output is correct
27 Correct 3 ms 2896 KB Output is correct
28 Correct 2 ms 2896 KB Output is correct
29 Correct 2 ms 2896 KB Output is correct
30 Correct 3 ms 2896 KB Output is correct
31 Correct 4 ms 2896 KB Output is correct
32 Correct 3 ms 2896 KB Output is correct
33 Correct 2 ms 2896 KB Output is correct
34 Correct 3 ms 2876 KB Output is correct
35 Correct 2 ms 1744 KB Output is correct
36 Correct 3 ms 2896 KB Output is correct
37 Correct 3 ms 2896 KB Output is correct
38 Correct 3 ms 2888 KB Output is correct
39 Correct 3 ms 2896 KB Output is correct
40 Correct 4 ms 2896 KB Output is correct
41 Correct 3 ms 2896 KB Output is correct
42 Correct 2 ms 2896 KB Output is correct
43 Correct 2 ms 2896 KB Output is correct
44 Correct 2 ms 2896 KB Output is correct
45 Correct 4 ms 2896 KB Output is correct
46 Correct 112 ms 80708 KB Output is correct
47 Correct 173 ms 127852 KB Output is correct
48 Correct 193 ms 127868 KB Output is correct
49 Correct 201 ms 127896 KB Output is correct
50 Correct 228 ms 127900 KB Output is correct
51 Correct 198 ms 127928 KB Output is correct
52 Correct 188 ms 127900 KB Output is correct
53 Correct 126 ms 127864 KB Output is correct
54 Correct 115 ms 128200 KB Output is correct
55 Correct 141 ms 127976 KB Output is correct
56 Correct 130 ms 128144 KB Output is correct
57 Correct 171 ms 127880 KB Output is correct
58 Correct 209 ms 127888 KB Output is correct
59 Correct 201 ms 127812 KB Output is correct
60 Correct 119 ms 128204 KB Output is correct
61 Correct 132 ms 127900 KB Output is correct
62 Correct 182 ms 127808 KB Output is correct
63 Correct 184 ms 127848 KB Output is correct
64 Correct 187 ms 127828 KB Output is correct
65 Correct 126 ms 128432 KB Output is correct
66 Correct 154 ms 127816 KB Output is correct
67 Correct 179 ms 123220 KB Output is correct
68 Correct 171 ms 127868 KB Output is correct
69 Correct 173 ms 127904 KB Output is correct
70 Correct 189 ms 127812 KB Output is correct
71 Correct 186 ms 127808 KB Output is correct
72 Correct 185 ms 127824 KB Output is correct
73 Correct 194 ms 127868 KB Output is correct
74 Correct 119 ms 127820 KB Output is correct
75 Correct 121 ms 128320 KB Output is correct
76 Correct 146 ms 127896 KB Output is correct
77 Correct 137 ms 128204 KB Output is correct
78 Correct 1098 ms 235048 KB Output is correct
79 Correct 1396 ms 269708 KB Output is correct
80 Correct 1510 ms 269284 KB Output is correct
81 Correct 1383 ms 230860 KB Output is correct
82 Correct 1194 ms 231112 KB Output is correct
83 Correct 1256 ms 231208 KB Output is correct
84 Correct 1514 ms 231160 KB Output is correct
85 Correct 1499 ms 310644 KB Output is correct
86 Correct 1352 ms 310592 KB Output is correct
87 Correct 1553 ms 430372 KB Output is correct
88 Correct 1416 ms 423660 KB Output is correct
89 Correct 1170 ms 310728 KB Output is correct
90 Correct 1428 ms 310712 KB Output is correct
91 Correct 1 ms 1104 KB Output is correct
92 Correct 3 ms 2896 KB Output is correct
93 Correct 2 ms 2896 KB Output is correct
94 Correct 198 ms 127840 KB Output is correct
95 Correct 209 ms 127800 KB Output is correct
96 Correct 194 ms 127788 KB Output is correct
97 Correct 132 ms 128312 KB Output is correct
98 Correct 129 ms 127836 KB Output is correct
99 Correct 186 ms 127844 KB Output is correct
100 Correct 208 ms 127860 KB Output is correct
101 Correct 190 ms 127936 KB Output is correct
102 Correct 130 ms 128248 KB Output is correct
103 Correct 144 ms 127832 KB Output is correct
104 Correct 3 ms 2852 KB Output is correct
105 Correct 3 ms 2828 KB Output is correct
106 Correct 3 ms 2896 KB Output is correct
107 Correct 3 ms 2896 KB Output is correct
108 Correct 2 ms 2896 KB Output is correct
109 Correct 4 ms 2896 KB Output is correct
110 Correct 3 ms 2896 KB Output is correct
111 Correct 3 ms 2896 KB Output is correct
112 Correct 2 ms 2896 KB Output is correct
113 Correct 2 ms 2896 KB Output is correct
114 Correct 303 ms 47112 KB Output is correct
115 Correct 1109 ms 207196 KB Output is correct
116 Correct 1215 ms 212512 KB Output is correct
117 Correct 1128 ms 224208 KB Output is correct
118 Correct 1134 ms 202344 KB Output is correct
119 Correct 1132 ms 242768 KB Output is correct
120 Correct 880 ms 224100 KB Output is correct
121 Correct 909 ms 225004 KB Output is correct
122 Correct 995 ms 224940 KB Output is correct
123 Correct 880 ms 224324 KB Output is correct
124 Correct 965 ms 231340 KB Output is correct
125 Correct 192 ms 127824 KB Output is correct
126 Correct 193 ms 127812 KB Output is correct
127 Correct 190 ms 127832 KB Output is correct
128 Correct 130 ms 128292 KB Output is correct
129 Correct 143 ms 127800 KB Output is correct
130 Correct 171 ms 123296 KB Output is correct
131 Correct 183 ms 127868 KB Output is correct
132 Correct 184 ms 127948 KB Output is correct
133 Correct 190 ms 127844 KB Output is correct
134 Correct 190 ms 127852 KB Output is correct
135 Correct 197 ms 127948 KB Output is correct
136 Correct 196 ms 127852 KB Output is correct
137 Correct 124 ms 127820 KB Output is correct
138 Correct 125 ms 128216 KB Output is correct
139 Correct 146 ms 127928 KB Output is correct
140 Correct 141 ms 128196 KB Output is correct
141 Correct 3 ms 2896 KB Output is correct
142 Correct 3 ms 2896 KB Output is correct
143 Correct 3 ms 2860 KB Output is correct
144 Correct 2 ms 2824 KB Output is correct
145 Correct 3 ms 2816 KB Output is correct
146 Correct 1 ms 1744 KB Output is correct
147 Correct 3 ms 2896 KB Output is correct
148 Correct 3 ms 2896 KB Output is correct
149 Correct 3 ms 2896 KB Output is correct
150 Correct 3 ms 2896 KB Output is correct
151 Correct 3 ms 2896 KB Output is correct
152 Correct 3 ms 2896 KB Output is correct
153 Correct 2 ms 2896 KB Output is correct
154 Correct 2 ms 2896 KB Output is correct
155 Correct 2 ms 2896 KB Output is correct
156 Correct 3 ms 2896 KB Output is correct
157 Correct 1125 ms 233712 KB Output is correct
158 Correct 1271 ms 271592 KB Output is correct
159 Correct 1309 ms 276068 KB Output is correct
160 Correct 1326 ms 264308 KB Output is correct
161 Correct 1343 ms 288684 KB Output is correct
162 Correct 1328 ms 267652 KB Output is correct
163 Correct 1375 ms 231656 KB Output is correct
164 Correct 1063 ms 201180 KB Output is correct
165 Correct 1054 ms 169616 KB Output is correct
166 Correct 1155 ms 230512 KB Output is correct
167 Correct 1204 ms 298600 KB Output is correct
168 Correct 1 ms 1104 KB Output is correct
169 Correct 849 ms 135332 KB Output is correct
170 Correct 1396 ms 277548 KB Output is correct
171 Correct 1341 ms 277116 KB Output is correct
172 Correct 1501 ms 266584 KB Output is correct
173 Correct 1649 ms 266484 KB Output is correct
174 Correct 1534 ms 266872 KB Output is correct
175 Correct 1447 ms 266788 KB Output is correct
176 Correct 1060 ms 187496 KB Output is correct
177 Correct 1016 ms 187428 KB Output is correct
178 Correct 1146 ms 263148 KB Output is correct
179 Correct 1115 ms 261280 KB Output is correct