답안 #897878

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
897878 2024-01-03T22:29:43 Z cadmiumsky Two Dishes (JOI19_dishes) C++17
74 / 100
3908 ms 235500 KB
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;

using ll = long long;
using ld = long double;

#define int ll
#define sz(x) ((int)(x).size())

using pii = pair<ll,ll>;
using tii = tuple<int,int,int>;

// default constructorul trebuie sa fie identitate
// sorry it had to be this way
template<typename Mono, typename Lazy>
struct AINT {
  const Mono ID_M = Mono();
  const Lazy ID_L = Lazy();
  struct Node {
    Mono val;
    Lazy lazy;
    Node(Mono a, Lazy b): val(a), lazy(b) {;}
    Node operator += (const Lazy& x) { return *this = Node(val + x, lazy + x); }
    Node operator + (const Node& x) const { return Node(x.val + val, Lazy()); }
  };
  
  vector<Node> aint;
  
  int n, L_limit, R_limit;
  
  void init(int _n) {
    n = _n;
    L_limit = 1;
    R_limit = n;
    aint.resize(2 * n + 5, Node(ID_M, ID_L));
    fill(all(aint), Node(ID_M, ID_L));
  }
  
  void init(int L, int R) {
    n = R - L + 1;
    L_limit = L;
    R_limit = R;
    aint.resize(2 * n + 5, Node(ID_M, ID_L));
    fill(all(aint), Node(ID_M, ID_L));
  }
  
  void push(int node, int L, int R) {
    if(aint[node].lazy != ID_L)
    aint[L] += aint[node].lazy;
    aint[R] += aint[node].lazy;
    aint[node].lazy = ID_L;
  }
  
  tii get_sons(int node, int cl, int cr) {
    return {cl + cr >> 1, node + 1, node + ((cl + cr >> 1) - cl + 1) * 2};
  }
  
  template<typename VecType>
  void write(const VecType& v) {
    write<VecType>(v, 1, 1, n);
  }
  
  template<typename VecType>
  void write(const VecType& v, int node, int cl, int cr) {
    if(cl == cr) {
      aint[node].val = v[cl];
      aint[node].lazy = ID_L;
      return;
    }
    
    auto [mid, L, R] = get_sons(node, cl, cr);
    
    write(v, L, cl, mid);
    write(v, R, mid + 1, cr);
    
    aint[node] = aint[L] + aint[R];
    return;
    
  }
  
  void set(int p, Mono val) { set(p, val, 1, L_limit, R_limit); }
  
  void set(int p, Mono val, int node, int cl, int cr) {
    if(cr < p || p < cl) return;
    if(cl == cr) { aint[node].val = val; return; }
    
    auto [mid, L, R] = get_sons(node, cl, cr);
    
    push(node, L, R);
    
    set(p, val, L, cl, mid);
    set(p, val, R, mid + 1, cr);
    aint[node] = aint[L] + aint[R];
    
    return;
  }
  
  void upd(int l, int r, Lazy x) { upd(l, r, x, 1, L_limit, R_limit); }
  
  void upd(int l, int r, Lazy x, int node, int cl, int cr) {
    if(cr < l || r < cl) return;
    if(l <= cl && cr <= r) {
      aint[node] += x;
      return;
    }
    
    auto [mid, L, R] = get_sons(node, cl, cr);
    
    push(node, L, R);
    
    upd(l, r, x, L, cl, mid);
    upd(l, r, x, R, mid + 1, cr);
    aint[node] = aint[L] + aint[R];
    
    return;
  }
  
  Mono query(int l, int r) { return query(l, r, 1, L_limit, R_limit); }
  
  Mono query(int l, int r, int node, int cl, int cr) {
    if(cr < l || r < cl) return ID_M;
    if(l <= cl && cr <= r) return aint[node].val;
    
    auto [mid, L, R] = get_sons(node, cl, cr);
    
    push(node, L, R);
    
    return query(l, r, L, cl, mid) + query(l, r, R, mid + 1, cr);
  }
  
  template<class CB>
  int find_right(CB&& cb) { return find_right(cb, 1, L_limit, R_limit); }
  
  template<class CB>
  int find_right(CB&& cb, int node, int cl, int cr) {
    if(!cb(aint[node].val, cl, cr)) return cr + 1;
    if(cl == cr) return cl;
    
    auto [mid, L, R] = get_sons(node, cl, cr);
    
    push(node, L, R);
    
    int tmp_rez = find_right(cb, L, cl, mid);
    if(tmp_rez == mid + 1) return find_right(cb, R, mid + 1, cr);
    return tmp_rez;
  }
  
  template<class CB>
  int find_left(CB&& cb) { return find_right(cb, 1, L_limit, R_limit); }  
  
  template<class CB>
  int find_left(CB&& cb, int node, int cl, int cr) {
    if(!cb(aint[node].val, cl, cr)) return cl - 1;
    if(cl == cr) return cl;
    
    auto [mid, L, R] = get_sons(node, cl, cr);
    
    push(node, L, R);
    
    int tmp_rez = find_right(cb, R, mid + 1, cr);
    if(tmp_rez == mid) return find_right(cb, L, cl, mid);
    return tmp_rez;
  }
  
  void print(int node, int cl, int cr) {
    if(cl == cr) {
      fprintf(stderr, "(%d, %d) ", aint[node].val.simple, aint[node].val.active);
      return;
    }
    
    auto [mid, L, R] = get_sons(node, cl, cr);
    
    push(node, L, R);
    
    print(L, cl, mid);
    print(R, mid + 1, cr);
    return;
  }
  
};

struct EMPT {
  EMPT operator +(const EMPT& x) const {return EMPT(); }
  bool operator != (const EMPT& x) const { return 0; }
};

struct Node {
  ll simple;
  ll active;
  
  Node(): simple(0), active(0) {;}
  Node(ll a, ll b): simple(a), active(b) {;}
  
  Node operator +(const Node& x) const { return Node(simple + x.simple, active + x.active); }
  Node operator +(const EMPT& x) const { return *this; }
};

const int nmax = 1e6 + 5;

ll A[nmax], ALimit[nmax], AScore[nmax];
ll B[nmax], BLimit[nmax], BScore[nmax];

vector<pii> eventscol[nmax];

//ll dp[nmax][nmax];

signed main() {
  cin.tie(0) -> sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  
  AINT<Node,EMPT> aint;
  aint.init(1, n); // stocam derivata s_i - s_i-1
  
  for(int i = 1; i <= n; i++)
    cin >> A[i] >> ALimit[i] >> AScore[i];
  
  for(int i = 1; i <= m; i++)
    cin >> B[i] >> BLimit[i] >> BScore[i];
  
  for(int i = 1; i <= n; i++) A[i] += A[i - 1];
  for(int i = 1; i <= m; i++) B[i] += B[i - 1];
  
  //for(int i = 1; i <= n; i++) cerr << A[i] << ' '; cerr << '\n';
  //for(int i = 1; i <= m; i++) cerr << B[i] << ' '; cerr << '\n';
  
  
  ll _0 = 0;
  
  auto pushLineMod = [&](int ptr, int C) {
    auto R = aint.query(ptr, ptr);
    R.active += C;
    aint.set(ptr, R);
  };
  
  auto pushColMod = [&](int ptr, int C) {
    auto R = aint.query(ptr, ptr);
    R.simple += C;
    aint.set(ptr, R);
  };
  
  for(int i = 1; i <= n; i++) _0 += AScore[i] * (AScore[i] < 0);
  for(int i = 1; i <= m; i++) _0 += BScore[i] * (BScore[i] < 0);
  
  for(int i = 1; i <= n; i++) {
    if(ALimit[i] < A[i] || AScore[i] == 0) continue;
    int u = distance(B, upper_bound(B, B + m + 1, ALimit[i] - A[i])) - 1;
    
    if(AScore[i] < 0) {
      //cerr << i << ", " << AScore[i] << ": " << u + 1 << '\n';
      eventscol[u + 1].emplace_back(i, -AScore[i]);
    }
    else {
      //cerr << i << ", " << AScore[i] << ": " << 0 << ' ' << u + 1 << '\n';
      eventscol[0].emplace_back(i, AScore[i]);
      eventscol[u + 1].emplace_back(i, -AScore[i]);
    }
  }
  
  //_0 = 0;
  
  //ll inutil = 0;
  
  //{
      //ll negC = 0;
  
      //for(int i = 1; i <= n; i++)
        //negC += (AScore[i] < 0) * AScore[i];
      //for(int i = 1; i <= m; i++)
        //negC += (BScore[i] < 0) * BScore[i];
      
      //for(int i = 0; i <= n; i++) {
        //for(int j = 0; j <= m; j++) {
          //if(AScore[i + 1] > 0) {
            //if(A[i + 1] + B[j] <= ALimit[i + 1])
              //dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + AScore[i + 1]);
            //else
              //dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
          //}
          //else {
            //if(A[i + 1] + B[j] > ALimit[i + 1])
              //dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] - AScore[i + 1]);
            //else
              //dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
          //}
          
          //if(BScore[j + 1] > 0) {
            //if(A[i] + B[j + 1] <= BLimit[j + 1])
              //dp[i][j + 1] = max(dp[i][j + 1], dp[i][j] + BScore[j + 1]);
            //else
              //dp[i][j + 1] = max(dp[i][j + 1], dp[i][j]);
          //}
          //else {
            //if(A[i] + B[j + 1] > BLimit[j + 1])
              //dp[i][j + 1] = max(dp[i][j + 1], dp[i][j] - BScore[j + 1]);
            //else
              //dp[i][j + 1] = max(dp[i][j + 1], dp[i][j]);
          //}
        //}
      //}
      
      //cerr << negC << '\n';
      
      //for(int j = 0; j <= m; j++) {
        //for(int i = 1; i <= n; i++)
          //cout << dp[i][j] << ' ';
        //cout << '\t';
        //for(int i = 1; i <= n; i++)
          //cout << dp[i][j] - dp[i - 1][j] << ' ';
        //cout << '\n';
      //}
  //}
  
  //cerr << _0 << '\n';
  
  for(int i = 0; i <= m; i++) {
    
    sort(all(eventscol[i]), [&](auto a, auto b) { return a.second < b.second; });
    
    for(auto [ptr, C] : eventscol[i]) {
      if(C > 0) {
        
        int cpy = C;
        
        auto finder = [&](Node val, int cl, int cr) -> bool {
          if(cr <= ptr) return 0;
          if(val.simple > 0) return 1;
          return 0;
        };
        
        while(1) {
          int nv_ptr = aint.find_right(finder);
          if(nv_ptr == n + 1) break;
          
          auto R = aint.query(nv_ptr, nv_ptr);
          int mn = min(C,  R.simple);
          C -= mn;
          R.simple -= mn;
          aint.set(nv_ptr, R);
          
          if(C == 0) break;
          ptr = nv_ptr;
        }
        
        pushLineMod(ptr, cpy);
      }
      else
        pushLineMod(ptr, C),
        pushColMod(ptr, -C);
    }
    
    if(i == 0 || BScore[i] == 0 || BLimit[i] < B[i]) {
      _0 -= (BScore[i] < 0) * BScore[i];
    //cerr << i << '\n';
      //cerr << _0 << ' ';
    //aint.print(1, 1, n);
    //cerr << "\n---\n";
      continue;
    }
    
    int u = distance(A, upper_bound(A, A + n + 1, BLimit[i] - B[i])) - 1;
    
    //cerr << B[i] << ' ' << BLimit[i] << '\n';
    //cerr << i << ": " << u << ", " << BScore[i] << '\n';
    //cerr << A[u] << ' ' << A[u + 1] << ' ' << BLimit[i] - B[i] << '\n';
     
    _0 += BScore[i] * (BScore[i] > 0);
    
    //inutil += (BScore[i] > 0) * BScore[i];
      
    if(u == n) {
    //cerr << i << '\n';
      //cerr << _0 << ' ';
    //aint.print(1, 1, n);
    //cerr << "\n---\n";
      continue;
    }
    
    if(BScore[i] < 0) {
      pushColMod(u + 1, -BScore[i]);
    }
    else {
      auto finder = [&](Node val, int cl, int cr) -> bool {
        if(cr <= u) return 0;
        if(val.simple > 0) return 1;
        return 0;
      };
      
      while(1) {
        int nv_u = aint.find_right(finder);
        //cerr << nv_u << '\n';
        if(nv_u == n + 1) break;
        
        auto R = aint.query(nv_u, nv_u);
        int mn = min(BScore[i], R.simple);
        BScore[i] -= mn;
        R.simple -= mn;
        aint.set(nv_u, R);
        
        if(BScore[i] == 0) break;
        u = nv_u;
      }
    }
    
  }
  
  auto R = aint.query(1, n);
  
  
  cout << _0 + R.simple + R.active << '\n';

  
}

/**
  Anul asta nu se da centroid
  -- Rugaciunile mele
*/

Compilation message

dishes.cpp: In instantiation of 'tii AINT<Mono, Lazy>::get_sons(ll, ll, ll) [with Mono = Node; Lazy = EMPT; tii = std::tuple<long long int, long long int, long long int>; ll = long long int]':
dishes.cpp:125:24:   required from 'Mono AINT<Mono, Lazy>::query(ll, ll, ll, ll, ll) [with Mono = Node; Lazy = EMPT; ll = long long int]'
dishes.cpp:119:42:   required from 'Mono AINT<Mono, Lazy>::query(ll, ll) [with Mono = Node; Lazy = EMPT; ll = long long int]'
dishes.cpp:232:33:   required from here
dishes.cpp:56:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   56 |     return {cl + cr >> 1, node + 1, node + ((cl + cr >> 1) - cl + 1) * 2};
      |             ~~~^~~~
dishes.cpp:56:49: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   56 |     return {cl + cr >> 1, node + 1, node + ((cl + cr >> 1) - cl + 1) * 2};
      |                                              ~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 329 ms 63960 KB Output is correct
2 Correct 337 ms 64192 KB Output is correct
3 Correct 194 ms 62384 KB Output is correct
4 Correct 255 ms 60352 KB Output is correct
5 Correct 7 ms 35420 KB Output is correct
6 Correct 339 ms 63136 KB Output is correct
7 Correct 56 ms 39508 KB Output is correct
8 Correct 141 ms 59836 KB Output is correct
9 Correct 200 ms 62416 KB Output is correct
10 Correct 396 ms 65212 KB Output is correct
11 Correct 163 ms 63664 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 35420 KB Output is correct
2 Correct 7 ms 35464 KB Output is correct
3 Correct 7 ms 35416 KB Output is correct
4 Correct 7 ms 35420 KB Output is correct
5 Correct 7 ms 35420 KB Output is correct
6 Correct 7 ms 35420 KB Output is correct
7 Correct 7 ms 35420 KB Output is correct
8 Correct 6 ms 35416 KB Output is correct
9 Correct 6 ms 35420 KB Output is correct
10 Correct 6 ms 35420 KB Output is correct
11 Correct 7 ms 35420 KB Output is correct
12 Correct 7 ms 35420 KB Output is correct
13 Correct 6 ms 35412 KB Output is correct
14 Correct 7 ms 35420 KB Output is correct
15 Correct 6 ms 35432 KB Output is correct
16 Correct 7 ms 35420 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 35420 KB Output is correct
2 Correct 7 ms 35464 KB Output is correct
3 Correct 7 ms 35416 KB Output is correct
4 Correct 7 ms 35420 KB Output is correct
5 Correct 7 ms 35420 KB Output is correct
6 Correct 7 ms 35420 KB Output is correct
7 Correct 7 ms 35420 KB Output is correct
8 Correct 6 ms 35416 KB Output is correct
9 Correct 6 ms 35420 KB Output is correct
10 Correct 6 ms 35420 KB Output is correct
11 Correct 7 ms 35420 KB Output is correct
12 Correct 7 ms 35420 KB Output is correct
13 Correct 6 ms 35412 KB Output is correct
14 Correct 7 ms 35420 KB Output is correct
15 Correct 6 ms 35432 KB Output is correct
16 Correct 7 ms 35420 KB Output is correct
17 Correct 9 ms 37724 KB Output is correct
18 Correct 8 ms 37724 KB Output is correct
19 Correct 10 ms 37724 KB Output is correct
20 Correct 10 ms 37800 KB Output is correct
21 Correct 9 ms 37724 KB Output is correct
22 Correct 10 ms 37780 KB Output is correct
23 Correct 9 ms 37724 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 35420 KB Output is correct
2 Correct 7 ms 35464 KB Output is correct
3 Correct 7 ms 35416 KB Output is correct
4 Correct 7 ms 35420 KB Output is correct
5 Correct 7 ms 35420 KB Output is correct
6 Correct 7 ms 35420 KB Output is correct
7 Correct 7 ms 35420 KB Output is correct
8 Correct 6 ms 35416 KB Output is correct
9 Correct 6 ms 35420 KB Output is correct
10 Correct 6 ms 35420 KB Output is correct
11 Correct 7 ms 35420 KB Output is correct
12 Correct 7 ms 35420 KB Output is correct
13 Correct 6 ms 35412 KB Output is correct
14 Correct 7 ms 35420 KB Output is correct
15 Correct 6 ms 35432 KB Output is correct
16 Correct 7 ms 35420 KB Output is correct
17 Correct 9 ms 37724 KB Output is correct
18 Correct 8 ms 37724 KB Output is correct
19 Correct 10 ms 37724 KB Output is correct
20 Correct 10 ms 37800 KB Output is correct
21 Correct 9 ms 37724 KB Output is correct
22 Correct 10 ms 37780 KB Output is correct
23 Correct 9 ms 37724 KB Output is correct
24 Correct 232 ms 73528 KB Output is correct
25 Correct 126 ms 68904 KB Output is correct
26 Correct 272 ms 75152 KB Output is correct
27 Correct 133 ms 69068 KB Output is correct
28 Correct 225 ms 74000 KB Output is correct
29 Correct 152 ms 75088 KB Output is correct
30 Correct 428 ms 74928 KB Output is correct
31 Correct 51 ms 44624 KB Output is correct
32 Correct 158 ms 64380 KB Output is correct
33 Correct 282 ms 69572 KB Output is correct
34 Correct 312 ms 73920 KB Output is correct
35 Correct 395 ms 68032 KB Output is correct
36 Correct 417 ms 68160 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 35420 KB Output is correct
2 Correct 7 ms 35464 KB Output is correct
3 Correct 7 ms 35416 KB Output is correct
4 Correct 7 ms 35420 KB Output is correct
5 Correct 7 ms 35420 KB Output is correct
6 Correct 7 ms 35420 KB Output is correct
7 Correct 7 ms 35420 KB Output is correct
8 Correct 6 ms 35416 KB Output is correct
9 Correct 6 ms 35420 KB Output is correct
10 Correct 6 ms 35420 KB Output is correct
11 Correct 7 ms 35420 KB Output is correct
12 Correct 7 ms 35420 KB Output is correct
13 Correct 6 ms 35412 KB Output is correct
14 Correct 7 ms 35420 KB Output is correct
15 Correct 6 ms 35432 KB Output is correct
16 Correct 7 ms 35420 KB Output is correct
17 Correct 9 ms 37724 KB Output is correct
18 Correct 8 ms 37724 KB Output is correct
19 Correct 10 ms 37724 KB Output is correct
20 Correct 10 ms 37800 KB Output is correct
21 Correct 9 ms 37724 KB Output is correct
22 Correct 10 ms 37780 KB Output is correct
23 Correct 9 ms 37724 KB Output is correct
24 Correct 232 ms 73528 KB Output is correct
25 Correct 126 ms 68904 KB Output is correct
26 Correct 272 ms 75152 KB Output is correct
27 Correct 133 ms 69068 KB Output is correct
28 Correct 225 ms 74000 KB Output is correct
29 Correct 152 ms 75088 KB Output is correct
30 Correct 428 ms 74928 KB Output is correct
31 Correct 51 ms 44624 KB Output is correct
32 Correct 158 ms 64380 KB Output is correct
33 Correct 282 ms 69572 KB Output is correct
34 Correct 312 ms 73920 KB Output is correct
35 Correct 395 ms 68032 KB Output is correct
36 Correct 417 ms 68160 KB Output is correct
37 Correct 294 ms 78016 KB Output is correct
38 Correct 165 ms 72148 KB Output is correct
39 Correct 342 ms 75484 KB Output is correct
40 Correct 393 ms 75452 KB Output is correct
41 Correct 6 ms 35420 KB Output is correct
42 Correct 555 ms 77668 KB Output is correct
43 Correct 324 ms 72384 KB Output is correct
44 Correct 395 ms 78280 KB Output is correct
45 Correct 540 ms 71104 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 35420 KB Output is correct
2 Correct 7 ms 35464 KB Output is correct
3 Correct 7 ms 35416 KB Output is correct
4 Correct 7 ms 35420 KB Output is correct
5 Correct 7 ms 35420 KB Output is correct
6 Correct 7 ms 35420 KB Output is correct
7 Correct 7 ms 35420 KB Output is correct
8 Correct 6 ms 35416 KB Output is correct
9 Correct 6 ms 35420 KB Output is correct
10 Correct 6 ms 35420 KB Output is correct
11 Correct 7 ms 35420 KB Output is correct
12 Correct 7 ms 35420 KB Output is correct
13 Correct 6 ms 35412 KB Output is correct
14 Correct 7 ms 35420 KB Output is correct
15 Correct 6 ms 35432 KB Output is correct
16 Correct 7 ms 35420 KB Output is correct
17 Correct 9 ms 37724 KB Output is correct
18 Correct 8 ms 37724 KB Output is correct
19 Correct 10 ms 37724 KB Output is correct
20 Correct 10 ms 37800 KB Output is correct
21 Correct 9 ms 37724 KB Output is correct
22 Correct 10 ms 37780 KB Output is correct
23 Correct 9 ms 37724 KB Output is correct
24 Correct 232 ms 73528 KB Output is correct
25 Correct 126 ms 68904 KB Output is correct
26 Correct 272 ms 75152 KB Output is correct
27 Correct 133 ms 69068 KB Output is correct
28 Correct 225 ms 74000 KB Output is correct
29 Correct 152 ms 75088 KB Output is correct
30 Correct 428 ms 74928 KB Output is correct
31 Correct 51 ms 44624 KB Output is correct
32 Correct 158 ms 64380 KB Output is correct
33 Correct 282 ms 69572 KB Output is correct
34 Correct 312 ms 73920 KB Output is correct
35 Correct 395 ms 68032 KB Output is correct
36 Correct 417 ms 68160 KB Output is correct
37 Correct 294 ms 78016 KB Output is correct
38 Correct 165 ms 72148 KB Output is correct
39 Correct 342 ms 75484 KB Output is correct
40 Correct 393 ms 75452 KB Output is correct
41 Correct 6 ms 35420 KB Output is correct
42 Correct 555 ms 77668 KB Output is correct
43 Correct 324 ms 72384 KB Output is correct
44 Correct 395 ms 78280 KB Output is correct
45 Correct 540 ms 71104 KB Output is correct
46 Correct 1748 ms 235500 KB Output is correct
47 Correct 928 ms 203696 KB Output is correct
48 Correct 1829 ms 221292 KB Output is correct
49 Correct 2333 ms 220980 KB Output is correct
50 Correct 3908 ms 229664 KB Output is correct
51 Correct 2033 ms 202524 KB Output is correct
52 Correct 2399 ms 222756 KB Output is correct
53 Correct 3442 ms 197676 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 329 ms 63960 KB Output is correct
2 Correct 337 ms 64192 KB Output is correct
3 Correct 194 ms 62384 KB Output is correct
4 Correct 255 ms 60352 KB Output is correct
5 Correct 7 ms 35420 KB Output is correct
6 Correct 339 ms 63136 KB Output is correct
7 Correct 56 ms 39508 KB Output is correct
8 Correct 141 ms 59836 KB Output is correct
9 Correct 200 ms 62416 KB Output is correct
10 Correct 396 ms 65212 KB Output is correct
11 Correct 163 ms 63664 KB Output is correct
12 Correct 6 ms 35420 KB Output is correct
13 Correct 7 ms 35464 KB Output is correct
14 Correct 7 ms 35416 KB Output is correct
15 Correct 7 ms 35420 KB Output is correct
16 Correct 7 ms 35420 KB Output is correct
17 Correct 7 ms 35420 KB Output is correct
18 Correct 7 ms 35420 KB Output is correct
19 Correct 6 ms 35416 KB Output is correct
20 Correct 6 ms 35420 KB Output is correct
21 Correct 6 ms 35420 KB Output is correct
22 Correct 7 ms 35420 KB Output is correct
23 Correct 7 ms 35420 KB Output is correct
24 Correct 6 ms 35412 KB Output is correct
25 Correct 7 ms 35420 KB Output is correct
26 Correct 6 ms 35432 KB Output is correct
27 Correct 7 ms 35420 KB Output is correct
28 Correct 9 ms 37724 KB Output is correct
29 Correct 8 ms 37724 KB Output is correct
30 Correct 10 ms 37724 KB Output is correct
31 Correct 10 ms 37800 KB Output is correct
32 Correct 9 ms 37724 KB Output is correct
33 Correct 10 ms 37780 KB Output is correct
34 Correct 9 ms 37724 KB Output is correct
35 Correct 232 ms 73528 KB Output is correct
36 Correct 126 ms 68904 KB Output is correct
37 Correct 272 ms 75152 KB Output is correct
38 Correct 133 ms 69068 KB Output is correct
39 Correct 225 ms 74000 KB Output is correct
40 Correct 152 ms 75088 KB Output is correct
41 Correct 428 ms 74928 KB Output is correct
42 Correct 51 ms 44624 KB Output is correct
43 Correct 158 ms 64380 KB Output is correct
44 Correct 282 ms 69572 KB Output is correct
45 Correct 312 ms 73920 KB Output is correct
46 Correct 395 ms 68032 KB Output is correct
47 Correct 417 ms 68160 KB Output is correct
48 Correct 294 ms 78016 KB Output is correct
49 Correct 165 ms 72148 KB Output is correct
50 Correct 342 ms 75484 KB Output is correct
51 Correct 393 ms 75452 KB Output is correct
52 Correct 6 ms 35420 KB Output is correct
53 Correct 555 ms 77668 KB Output is correct
54 Correct 324 ms 72384 KB Output is correct
55 Correct 395 ms 78280 KB Output is correct
56 Correct 540 ms 71104 KB Output is correct
57 Correct 174 ms 75456 KB Output is correct
58 Incorrect 166 ms 71372 KB Output isn't correct
59 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 329 ms 63960 KB Output is correct
2 Correct 337 ms 64192 KB Output is correct
3 Correct 194 ms 62384 KB Output is correct
4 Correct 255 ms 60352 KB Output is correct
5 Correct 7 ms 35420 KB Output is correct
6 Correct 339 ms 63136 KB Output is correct
7 Correct 56 ms 39508 KB Output is correct
8 Correct 141 ms 59836 KB Output is correct
9 Correct 200 ms 62416 KB Output is correct
10 Correct 396 ms 65212 KB Output is correct
11 Correct 163 ms 63664 KB Output is correct
12 Correct 6 ms 35420 KB Output is correct
13 Correct 7 ms 35464 KB Output is correct
14 Correct 7 ms 35416 KB Output is correct
15 Correct 7 ms 35420 KB Output is correct
16 Correct 7 ms 35420 KB Output is correct
17 Correct 7 ms 35420 KB Output is correct
18 Correct 7 ms 35420 KB Output is correct
19 Correct 6 ms 35416 KB Output is correct
20 Correct 6 ms 35420 KB Output is correct
21 Correct 6 ms 35420 KB Output is correct
22 Correct 7 ms 35420 KB Output is correct
23 Correct 7 ms 35420 KB Output is correct
24 Correct 6 ms 35412 KB Output is correct
25 Correct 7 ms 35420 KB Output is correct
26 Correct 6 ms 35432 KB Output is correct
27 Correct 7 ms 35420 KB Output is correct
28 Correct 9 ms 37724 KB Output is correct
29 Correct 8 ms 37724 KB Output is correct
30 Correct 10 ms 37724 KB Output is correct
31 Correct 10 ms 37800 KB Output is correct
32 Correct 9 ms 37724 KB Output is correct
33 Correct 10 ms 37780 KB Output is correct
34 Correct 9 ms 37724 KB Output is correct
35 Correct 232 ms 73528 KB Output is correct
36 Correct 126 ms 68904 KB Output is correct
37 Correct 272 ms 75152 KB Output is correct
38 Correct 133 ms 69068 KB Output is correct
39 Correct 225 ms 74000 KB Output is correct
40 Correct 152 ms 75088 KB Output is correct
41 Correct 428 ms 74928 KB Output is correct
42 Correct 51 ms 44624 KB Output is correct
43 Correct 158 ms 64380 KB Output is correct
44 Correct 282 ms 69572 KB Output is correct
45 Correct 312 ms 73920 KB Output is correct
46 Correct 395 ms 68032 KB Output is correct
47 Correct 417 ms 68160 KB Output is correct
48 Correct 294 ms 78016 KB Output is correct
49 Correct 165 ms 72148 KB Output is correct
50 Correct 342 ms 75484 KB Output is correct
51 Correct 393 ms 75452 KB Output is correct
52 Correct 6 ms 35420 KB Output is correct
53 Correct 555 ms 77668 KB Output is correct
54 Correct 324 ms 72384 KB Output is correct
55 Correct 395 ms 78280 KB Output is correct
56 Correct 540 ms 71104 KB Output is correct
57 Correct 1748 ms 235500 KB Output is correct
58 Correct 928 ms 203696 KB Output is correct
59 Correct 1829 ms 221292 KB Output is correct
60 Correct 2333 ms 220980 KB Output is correct
61 Correct 3908 ms 229664 KB Output is correct
62 Correct 2033 ms 202524 KB Output is correct
63 Correct 2399 ms 222756 KB Output is correct
64 Correct 3442 ms 197676 KB Output is correct
65 Correct 174 ms 75456 KB Output is correct
66 Incorrect 166 ms 71372 KB Output isn't correct
67 Halted 0 ms 0 KB -