Submission #986278

# Submission time Handle Problem Language Result Execution time Memory
986278 2024-05-20T08:20:36 Z vjudge1 Interval Collection (CCO20_day2problem2) C++17
22 / 25
7000 ms 230660 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<int,int>;
using tii = tuple<int,int,int>;

const int inf = 1e9 + 9;
const int nmax = 1e6 + 1;

template<typename T>
struct AINT {
   vector<T> aint;
   int n;
   void init(int n_) {
      n = n_;
      aint.resize(n * 2 + 5, T());
   }
   template<class CB> void walk(CB&& cb) { walk(cb, 1, n); }
   template<class CB> void walk(CB&& cb, int l, int r) { walk(cb, l, r, 1, 1, n); }
   template<class CB> void walk(CB&& cb, int l, int r, int node, int cl, int cr) { 
      if(cr < l || r < cl) return;
      if(l <= cl && cr <= r && !cb(aint[node], cl, cr)) return;
      int mid = (cl + cr) >> 1, L = node + 1, R = node + (mid - cl + 1) * 2;
      walk(cb, l, r, L, cl, mid);
      walk(cb, l, r, R, mid + 1, cr);
      aint[node].pull(aint[L], aint[R]);
   }
};

namespace DS {
   auto byL = [](pii a, pii b) { return a.first < b.first || (a.first == b.first && a.second > b.second); };
   auto byR = [](pii a, pii b) { return a.second < b.second || (a.second == b.second && a.first > b.first); };
   multiset<pii, decltype(byL)> sortL(byL);
   multiset<pii, decltype(byR)> sortR(byR);
   
   struct segm {
      int l, r;
      segm(): l(-inf * 2), r(inf * 2) {;}
      void pull(const segm& a, const segm& b) { l = max(a.l, b.l); r = min(b.r, a.r); }
   };
   
   AINT<segm> aint;
   vector<int> ans;
   vector<pair<int, segm>> rollback;
   vector<pii> efectiv;
   
   void insert(int l, int r) {
      efectiv.emplace_back(l, r);
      efectiv.emplace_back(-1, -1);
      
      sortL.insert(pii{l, r});
      sortR.insert(pii{l, r});
      
      ans.push_back(ans.empty()? inf : ans.back());
      aint.walk([&](segm& val, int cl, int cr) {
         //cerr << cl << ' ' << cr << '\t' << val.l << ' ' << val.r << '\t' << l << ' ' << r << '\n';
         ans.back() = min(ans.back(), r - val.l); return 0;
      }, 1, l);
      aint.walk([&](segm& val, int cl, int cr) {
         ans.back() = min(ans.back(), val.r - l); return 0;
      }, r, nmax);
      
      aint.walk([&](segm& val, int cl, int cr) {
         rollback.emplace_back(cl, val);
         val.r = min(val.r, r);
         return 0;
      }, l, l);
      aint.walk([&](segm& val, int cl, int cr) {
         rollback.emplace_back(cl, val);
         ans.emplace_back(ans.back());
         val.l = max(val.l, l);
         return 0;
      }, r, r);
      
      assert(ans.size() == rollback.size());
   }
   
   int time() { return sz(rollback); }
   void pop() {
      auto [l, r] = efectiv.back();
      if(l != -1 && r != -1) sortL.erase(sortL.find(pii{l, r})), sortR.erase(sortR.find(pii{l, r}));
      aint.walk([&](segm& val, int cl, int cr) {
         val = rollback.back().second;
         return 0;
      }, rollback.back().first, rollback.back().first);
      
      ans.pop_back();
      efectiv.pop_back();
      rollback.pop_back();
   }
   
   int query() {
      
      //for(auto [a, b] : sortL) cerr << a << ' ' << b << '\t';
      //cerr << "--\n";
      
      if(ans.empty() || ans.back() >= nmax + 5) {
         auto a = *sortL.rbegin(), b = *sortR.begin();
         return max(b.second, a.second) - min(b.first, a.first);
      }
      return ans.back();
   }
}


int started = 0;

struct memory {
   vector<pii> values;
   int enter_time;
   void pull(const memory& a, const memory& b) {
      if(!started) return;
      while(DS::time() > enter_time) DS::pop();
   }
};

signed main() {
   cin.tie(0) -> sync_with_stdio(0);
   int n;
   cin >> n;
   
   map<pii, vector<int>> still;
   vector<pii> segms;
   vector<pii> times;
   for(int i = 1; i <= n; i++) {
      char ch;
      cin >> ch;
      if(ch == 'A') {
         int l, r;
         cin >> l >> r;
         segms.emplace_back(l, r);
         times.emplace_back(i, n);
         still[pii{l, r}].emplace_back(sz(segms) - 1);
      }
      else {
         int l, r;
         cin >> l >> r;
         auto t = still[pii{l, r}].back();
         still[pii{l, r}].pop_back();
         times[t].second = i - 1;
      }
   }
   
   
   AINT<memory> foroper;
   foroper.init(n);
   
   DS::aint.init(nmax);
   
   for(int i = 0; i < sz(segms); i++) {
      foroper.walk([&](memory& val, int cl, int cr) {
         val.values.emplace_back(segms[i]);
         return 0;
      }, times[i].first, times[i].second);
   }
   
   started = 1;
   foroper.walk([&](memory& val, int cl, int cr) {
      val.enter_time = DS::time();
      for(auto [a, b] : val.values) DS::insert(a, b);
      
      //cerr << '\t' << cl << ' ' << cr << '\n';
      //for(auto [a, b] : val.values) cerr << a << ' ' << b <<'\t';
      //cerr << "\n--\n";
      
      if(cl != cr) return 1;
      cout << DS::query() << '\n';
      
      //cerr << '\t' << DS::time() << ' '<< val.enter_time << '\n';
      while(DS::time() > val.enter_time) DS::pop();
      return 0;
   });
   
   return 0;
}

/**
      Istenem! Nu poate fi real.
-- Surse verificate
*/

# Verdict Execution time Memory Grader output
1 Correct 7 ms 16220 KB Output is correct
2 Correct 6 ms 16220 KB Output is correct
3 Correct 5 ms 16216 KB Output is correct
4 Correct 4 ms 15964 KB Output is correct
5 Correct 7 ms 16208 KB Output is correct
6 Correct 8 ms 16220 KB Output is correct
7 Correct 5 ms 16216 KB Output is correct
8 Correct 5 ms 16220 KB Output is correct
9 Correct 7 ms 16220 KB Output is correct
10 Correct 7 ms 16256 KB Output is correct
11 Correct 7 ms 16268 KB Output is correct
12 Correct 7 ms 16220 KB Output is correct
13 Correct 7 ms 16272 KB Output is correct
14 Correct 7 ms 16220 KB Output is correct
15 Correct 8 ms 16220 KB Output is correct
16 Correct 7 ms 16264 KB Output is correct
17 Correct 6 ms 16260 KB Output is correct
18 Correct 6 ms 16220 KB Output is correct
19 Correct 4 ms 15964 KB Output is correct
20 Correct 4 ms 15964 KB Output is correct
21 Correct 7 ms 16220 KB Output is correct
22 Correct 7 ms 16220 KB Output is correct
23 Correct 5 ms 16220 KB Output is correct
24 Correct 5 ms 16052 KB Output is correct
25 Correct 7 ms 16220 KB Output is correct
26 Correct 7 ms 16164 KB Output is correct
27 Correct 7 ms 16220 KB Output is correct
28 Correct 6 ms 16072 KB Output is correct
29 Correct 10 ms 16220 KB Output is correct
30 Correct 7 ms 16220 KB Output is correct
31 Correct 8 ms 16220 KB Output is correct
32 Correct 7 ms 16220 KB Output is correct
33 Correct 4 ms 16140 KB Output is correct
34 Correct 4 ms 15964 KB Output is correct
35 Correct 5 ms 15964 KB Output is correct
36 Correct 4 ms 15984 KB Output is correct
37 Correct 5 ms 16220 KB Output is correct
38 Correct 5 ms 16220 KB Output is correct
39 Correct 4 ms 15964 KB Output is correct
40 Correct 5 ms 15964 KB Output is correct
41 Correct 6 ms 16216 KB Output is correct
42 Correct 5 ms 16220 KB Output is correct
43 Correct 4 ms 15964 KB Output is correct
44 Correct 5 ms 15964 KB Output is correct
45 Correct 7 ms 16220 KB Output is correct
46 Correct 5 ms 16220 KB Output is correct
47 Correct 5 ms 15964 KB Output is correct
48 Correct 5 ms 15964 KB Output is correct
49 Correct 6 ms 16220 KB Output is correct
50 Correct 6 ms 16220 KB Output is correct
51 Correct 5 ms 16220 KB Output is correct
52 Correct 5 ms 16220 KB Output is correct
53 Correct 6 ms 16220 KB Output is correct
54 Correct 6 ms 16236 KB Output is correct
55 Correct 5 ms 16220 KB Output is correct
56 Correct 5 ms 16220 KB Output is correct
57 Correct 5 ms 16216 KB Output is correct
58 Correct 5 ms 16220 KB Output is correct
59 Correct 6 ms 16220 KB Output is correct
60 Correct 6 ms 16220 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 16220 KB Output is correct
2 Correct 6 ms 16220 KB Output is correct
3 Correct 5 ms 16216 KB Output is correct
4 Correct 4 ms 15964 KB Output is correct
5 Correct 7 ms 16208 KB Output is correct
6 Correct 8 ms 16220 KB Output is correct
7 Correct 5 ms 16216 KB Output is correct
8 Correct 5 ms 16220 KB Output is correct
9 Correct 7 ms 16220 KB Output is correct
10 Correct 7 ms 16256 KB Output is correct
11 Correct 7 ms 16268 KB Output is correct
12 Correct 7 ms 16220 KB Output is correct
13 Correct 7 ms 16272 KB Output is correct
14 Correct 7 ms 16220 KB Output is correct
15 Correct 8 ms 16220 KB Output is correct
16 Correct 7 ms 16264 KB Output is correct
17 Correct 6 ms 16260 KB Output is correct
18 Correct 6 ms 16220 KB Output is correct
19 Correct 4 ms 15964 KB Output is correct
20 Correct 4 ms 15964 KB Output is correct
21 Correct 7 ms 16220 KB Output is correct
22 Correct 7 ms 16220 KB Output is correct
23 Correct 5 ms 16220 KB Output is correct
24 Correct 5 ms 16052 KB Output is correct
25 Correct 7 ms 16220 KB Output is correct
26 Correct 7 ms 16164 KB Output is correct
27 Correct 7 ms 16220 KB Output is correct
28 Correct 6 ms 16072 KB Output is correct
29 Correct 10 ms 16220 KB Output is correct
30 Correct 7 ms 16220 KB Output is correct
31 Correct 8 ms 16220 KB Output is correct
32 Correct 7 ms 16220 KB Output is correct
33 Correct 4 ms 16140 KB Output is correct
34 Correct 4 ms 15964 KB Output is correct
35 Correct 5 ms 15964 KB Output is correct
36 Correct 4 ms 15984 KB Output is correct
37 Correct 5 ms 16220 KB Output is correct
38 Correct 5 ms 16220 KB Output is correct
39 Correct 4 ms 15964 KB Output is correct
40 Correct 5 ms 15964 KB Output is correct
41 Correct 6 ms 16216 KB Output is correct
42 Correct 5 ms 16220 KB Output is correct
43 Correct 4 ms 15964 KB Output is correct
44 Correct 5 ms 15964 KB Output is correct
45 Correct 7 ms 16220 KB Output is correct
46 Correct 5 ms 16220 KB Output is correct
47 Correct 5 ms 15964 KB Output is correct
48 Correct 5 ms 15964 KB Output is correct
49 Correct 6 ms 16220 KB Output is correct
50 Correct 6 ms 16220 KB Output is correct
51 Correct 5 ms 16220 KB Output is correct
52 Correct 5 ms 16220 KB Output is correct
53 Correct 6 ms 16220 KB Output is correct
54 Correct 6 ms 16236 KB Output is correct
55 Correct 5 ms 16220 KB Output is correct
56 Correct 5 ms 16220 KB Output is correct
57 Correct 5 ms 16216 KB Output is correct
58 Correct 5 ms 16220 KB Output is correct
59 Correct 6 ms 16220 KB Output is correct
60 Correct 6 ms 16220 KB Output is correct
61 Correct 3 ms 15964 KB Output is correct
62 Correct 4 ms 15964 KB Output is correct
63 Correct 3 ms 15944 KB Output is correct
64 Correct 153 ms 19988 KB Output is correct
65 Correct 109 ms 19036 KB Output is correct
66 Correct 77 ms 18728 KB Output is correct
67 Correct 24 ms 18008 KB Output is correct
68 Correct 154 ms 20076 KB Output is correct
69 Correct 112 ms 19036 KB Output is correct
70 Correct 85 ms 18768 KB Output is correct
71 Correct 63 ms 18524 KB Output is correct
72 Correct 160 ms 20944 KB Output is correct
73 Correct 143 ms 20572 KB Output is correct
74 Correct 141 ms 20408 KB Output is correct
75 Correct 140 ms 20444 KB Output is correct
76 Correct 159 ms 21260 KB Output is correct
77 Correct 165 ms 21408 KB Output is correct
78 Correct 157 ms 21268 KB Output is correct
79 Correct 162 ms 21260 KB Output is correct
80 Correct 148 ms 20088 KB Output is correct
81 Correct 108 ms 19036 KB Output is correct
82 Correct 75 ms 18740 KB Output is correct
83 Correct 24 ms 18008 KB Output is correct
84 Correct 147 ms 20048 KB Output is correct
85 Correct 114 ms 19548 KB Output is correct
86 Correct 80 ms 18520 KB Output is correct
87 Correct 66 ms 18524 KB Output is correct
88 Correct 157 ms 20940 KB Output is correct
89 Correct 143 ms 20664 KB Output is correct
90 Correct 139 ms 20388 KB Output is correct
91 Correct 134 ms 20268 KB Output is correct
92 Correct 165 ms 21492 KB Output is correct
93 Correct 167 ms 21260 KB Output is correct
94 Correct 159 ms 21260 KB Output is correct
95 Correct 177 ms 21564 KB Output is correct
96 Correct 24 ms 18008 KB Output is correct
97 Correct 23 ms 18012 KB Output is correct
98 Correct 25 ms 18012 KB Output is correct
99 Correct 24 ms 18012 KB Output is correct
100 Correct 67 ms 18592 KB Output is correct
101 Correct 50 ms 18264 KB Output is correct
102 Correct 60 ms 18552 KB Output is correct
103 Correct 25 ms 18008 KB Output is correct
104 Correct 139 ms 20048 KB Output is correct
105 Correct 99 ms 19012 KB Output is correct
106 Correct 69 ms 18520 KB Output is correct
107 Correct 26 ms 18248 KB Output is correct
108 Correct 142 ms 19688 KB Output is correct
109 Correct 106 ms 18960 KB Output is correct
110 Correct 73 ms 18560 KB Output is correct
111 Correct 27 ms 18268 KB Output is correct
112 Correct 64 ms 19540 KB Output is correct
113 Correct 81 ms 19660 KB Output is correct
114 Correct 66 ms 19540 KB Output is correct
115 Correct 86 ms 19828 KB Output is correct
116 Correct 64 ms 19560 KB Output is correct
117 Correct 80 ms 19536 KB Output is correct
118 Correct 63 ms 19536 KB Output is correct
119 Correct 80 ms 19800 KB Output is correct
120 Correct 64 ms 19540 KB Output is correct
121 Correct 81 ms 19520 KB Output is correct
122 Correct 114 ms 21264 KB Output is correct
123 Correct 111 ms 21156 KB Output is correct
124 Correct 93 ms 18780 KB Output is correct
125 Correct 75 ms 18268 KB Output is correct
126 Correct 71 ms 18264 KB Output is correct
127 Correct 98 ms 19024 KB Output is correct
128 Correct 74 ms 18448 KB Output is correct
129 Correct 72 ms 18316 KB Output is correct
130 Correct 102 ms 19248 KB Output is correct
131 Correct 75 ms 18264 KB Output is correct
132 Correct 71 ms 18264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 16220 KB Output is correct
2 Correct 6 ms 16220 KB Output is correct
3 Correct 5 ms 16216 KB Output is correct
4 Correct 4 ms 15964 KB Output is correct
5 Correct 7 ms 16208 KB Output is correct
6 Correct 8 ms 16220 KB Output is correct
7 Correct 5 ms 16216 KB Output is correct
8 Correct 5 ms 16220 KB Output is correct
9 Correct 7 ms 16220 KB Output is correct
10 Correct 7 ms 16256 KB Output is correct
11 Correct 7 ms 16268 KB Output is correct
12 Correct 7 ms 16220 KB Output is correct
13 Correct 7 ms 16272 KB Output is correct
14 Correct 7 ms 16220 KB Output is correct
15 Correct 8 ms 16220 KB Output is correct
16 Correct 7 ms 16264 KB Output is correct
17 Correct 6 ms 16260 KB Output is correct
18 Correct 6 ms 16220 KB Output is correct
19 Correct 4 ms 15964 KB Output is correct
20 Correct 4 ms 15964 KB Output is correct
21 Correct 7 ms 16220 KB Output is correct
22 Correct 7 ms 16220 KB Output is correct
23 Correct 5 ms 16220 KB Output is correct
24 Correct 5 ms 16052 KB Output is correct
25 Correct 7 ms 16220 KB Output is correct
26 Correct 7 ms 16164 KB Output is correct
27 Correct 7 ms 16220 KB Output is correct
28 Correct 6 ms 16072 KB Output is correct
29 Correct 10 ms 16220 KB Output is correct
30 Correct 7 ms 16220 KB Output is correct
31 Correct 8 ms 16220 KB Output is correct
32 Correct 7 ms 16220 KB Output is correct
33 Correct 4 ms 16140 KB Output is correct
34 Correct 4 ms 15964 KB Output is correct
35 Correct 5 ms 15964 KB Output is correct
36 Correct 4 ms 15984 KB Output is correct
37 Correct 5 ms 16220 KB Output is correct
38 Correct 5 ms 16220 KB Output is correct
39 Correct 4 ms 15964 KB Output is correct
40 Correct 5 ms 15964 KB Output is correct
41 Correct 6 ms 16216 KB Output is correct
42 Correct 5 ms 16220 KB Output is correct
43 Correct 4 ms 15964 KB Output is correct
44 Correct 5 ms 15964 KB Output is correct
45 Correct 7 ms 16220 KB Output is correct
46 Correct 5 ms 16220 KB Output is correct
47 Correct 5 ms 15964 KB Output is correct
48 Correct 5 ms 15964 KB Output is correct
49 Correct 6 ms 16220 KB Output is correct
50 Correct 6 ms 16220 KB Output is correct
51 Correct 5 ms 16220 KB Output is correct
52 Correct 5 ms 16220 KB Output is correct
53 Correct 6 ms 16220 KB Output is correct
54 Correct 6 ms 16236 KB Output is correct
55 Correct 5 ms 16220 KB Output is correct
56 Correct 5 ms 16220 KB Output is correct
57 Correct 5 ms 16216 KB Output is correct
58 Correct 5 ms 16220 KB Output is correct
59 Correct 6 ms 16220 KB Output is correct
60 Correct 6 ms 16220 KB Output is correct
61 Correct 3 ms 15964 KB Output is correct
62 Correct 4 ms 15964 KB Output is correct
63 Correct 3 ms 15944 KB Output is correct
64 Correct 153 ms 19988 KB Output is correct
65 Correct 109 ms 19036 KB Output is correct
66 Correct 77 ms 18728 KB Output is correct
67 Correct 24 ms 18008 KB Output is correct
68 Correct 154 ms 20076 KB Output is correct
69 Correct 112 ms 19036 KB Output is correct
70 Correct 85 ms 18768 KB Output is correct
71 Correct 63 ms 18524 KB Output is correct
72 Correct 160 ms 20944 KB Output is correct
73 Correct 143 ms 20572 KB Output is correct
74 Correct 141 ms 20408 KB Output is correct
75 Correct 140 ms 20444 KB Output is correct
76 Correct 159 ms 21260 KB Output is correct
77 Correct 165 ms 21408 KB Output is correct
78 Correct 157 ms 21268 KB Output is correct
79 Correct 162 ms 21260 KB Output is correct
80 Correct 148 ms 20088 KB Output is correct
81 Correct 108 ms 19036 KB Output is correct
82 Correct 75 ms 18740 KB Output is correct
83 Correct 24 ms 18008 KB Output is correct
84 Correct 147 ms 20048 KB Output is correct
85 Correct 114 ms 19548 KB Output is correct
86 Correct 80 ms 18520 KB Output is correct
87 Correct 66 ms 18524 KB Output is correct
88 Correct 157 ms 20940 KB Output is correct
89 Correct 143 ms 20664 KB Output is correct
90 Correct 139 ms 20388 KB Output is correct
91 Correct 134 ms 20268 KB Output is correct
92 Correct 165 ms 21492 KB Output is correct
93 Correct 167 ms 21260 KB Output is correct
94 Correct 159 ms 21260 KB Output is correct
95 Correct 177 ms 21564 KB Output is correct
96 Correct 24 ms 18008 KB Output is correct
97 Correct 23 ms 18012 KB Output is correct
98 Correct 25 ms 18012 KB Output is correct
99 Correct 24 ms 18012 KB Output is correct
100 Correct 67 ms 18592 KB Output is correct
101 Correct 50 ms 18264 KB Output is correct
102 Correct 60 ms 18552 KB Output is correct
103 Correct 25 ms 18008 KB Output is correct
104 Correct 139 ms 20048 KB Output is correct
105 Correct 99 ms 19012 KB Output is correct
106 Correct 69 ms 18520 KB Output is correct
107 Correct 26 ms 18248 KB Output is correct
108 Correct 142 ms 19688 KB Output is correct
109 Correct 106 ms 18960 KB Output is correct
110 Correct 73 ms 18560 KB Output is correct
111 Correct 27 ms 18268 KB Output is correct
112 Correct 64 ms 19540 KB Output is correct
113 Correct 81 ms 19660 KB Output is correct
114 Correct 66 ms 19540 KB Output is correct
115 Correct 86 ms 19828 KB Output is correct
116 Correct 64 ms 19560 KB Output is correct
117 Correct 80 ms 19536 KB Output is correct
118 Correct 63 ms 19536 KB Output is correct
119 Correct 80 ms 19800 KB Output is correct
120 Correct 64 ms 19540 KB Output is correct
121 Correct 81 ms 19520 KB Output is correct
122 Correct 114 ms 21264 KB Output is correct
123 Correct 111 ms 21156 KB Output is correct
124 Correct 93 ms 18780 KB Output is correct
125 Correct 75 ms 18268 KB Output is correct
126 Correct 71 ms 18264 KB Output is correct
127 Correct 98 ms 19024 KB Output is correct
128 Correct 74 ms 18448 KB Output is correct
129 Correct 72 ms 18316 KB Output is correct
130 Correct 102 ms 19248 KB Output is correct
131 Correct 75 ms 18264 KB Output is correct
132 Correct 71 ms 18264 KB Output is correct
133 Correct 794 ms 33604 KB Output is correct
134 Correct 588 ms 29004 KB Output is correct
135 Correct 413 ms 27608 KB Output is correct
136 Correct 124 ms 25408 KB Output is correct
137 Correct 778 ms 33508 KB Output is correct
138 Correct 602 ms 29012 KB Output is correct
139 Correct 418 ms 27720 KB Output is correct
140 Correct 297 ms 26404 KB Output is correct
141 Correct 840 ms 36660 KB Output is correct
142 Correct 764 ms 35068 KB Output is correct
143 Correct 751 ms 34752 KB Output is correct
144 Correct 757 ms 34952 KB Output is correct
145 Correct 868 ms 38200 KB Output is correct
146 Correct 870 ms 38324 KB Output is correct
147 Correct 853 ms 38324 KB Output is correct
148 Correct 861 ms 38252 KB Output is correct
149 Correct 776 ms 33472 KB Output is correct
150 Correct 587 ms 29036 KB Output is correct
151 Correct 407 ms 27584 KB Output is correct
152 Correct 122 ms 25416 KB Output is correct
153 Correct 795 ms 33416 KB Output is correct
154 Correct 588 ms 29032 KB Output is correct
155 Correct 405 ms 27212 KB Output is correct
156 Correct 285 ms 26448 KB Output is correct
157 Correct 834 ms 36532 KB Output is correct
158 Correct 768 ms 35004 KB Output is correct
159 Correct 733 ms 35008 KB Output is correct
160 Correct 709 ms 34428 KB Output is correct
161 Correct 823 ms 38268 KB Output is correct
162 Correct 841 ms 38056 KB Output is correct
163 Correct 842 ms 38392 KB Output is correct
164 Correct 826 ms 38224 KB Output is correct
165 Correct 88 ms 24648 KB Output is correct
166 Correct 90 ms 24724 KB Output is correct
167 Correct 89 ms 24652 KB Output is correct
168 Correct 89 ms 24648 KB Output is correct
169 Correct 305 ms 26624 KB Output is correct
170 Correct 244 ms 26184 KB Output is correct
171 Correct 217 ms 26052 KB Output is correct
172 Correct 111 ms 25104 KB Output is correct
173 Correct 723 ms 33184 KB Output is correct
174 Correct 540 ms 28960 KB Output is correct
175 Correct 367 ms 27052 KB Output is correct
176 Correct 122 ms 25112 KB Output is correct
177 Correct 756 ms 31272 KB Output is correct
178 Correct 543 ms 28132 KB Output is correct
179 Correct 404 ms 27096 KB Output is correct
180 Correct 125 ms 25160 KB Output is correct
181 Correct 296 ms 31260 KB Output is correct
182 Correct 395 ms 31420 KB Output is correct
183 Correct 284 ms 31164 KB Output is correct
184 Correct 397 ms 31420 KB Output is correct
185 Correct 289 ms 31384 KB Output is correct
186 Correct 402 ms 31396 KB Output is correct
187 Correct 291 ms 31336 KB Output is correct
188 Correct 416 ms 31632 KB Output is correct
189 Correct 291 ms 31328 KB Output is correct
190 Correct 404 ms 31164 KB Output is correct
191 Correct 520 ms 38372 KB Output is correct
192 Correct 516 ms 38124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2249 ms 103468 KB Output is correct
2 Correct 2288 ms 105348 KB Output is correct
3 Correct 4695 ms 193464 KB Output is correct
4 Correct 4685 ms 194088 KB Output is correct
5 Correct 5811 ms 230660 KB Output is correct
6 Correct 5788 ms 229628 KB Output is correct
7 Correct 5705 ms 118704 KB Output is correct
8 Correct 4487 ms 106640 KB Output is correct
9 Correct 4189 ms 104856 KB Output is correct
10 Correct 6489 ms 130736 KB Output is correct
11 Correct 4462 ms 106808 KB Output is correct
12 Correct 4152 ms 104332 KB Output is correct
13 Correct 6617 ms 133368 KB Output is correct
14 Correct 4499 ms 107344 KB Output is correct
15 Correct 4185 ms 104528 KB Output is correct
16 Correct 1996 ms 101520 KB Output is correct
17 Correct 1965 ms 101820 KB Output is correct
18 Correct 1984 ms 101784 KB Output is correct
19 Correct 2019 ms 101944 KB Output is correct
20 Correct 1999 ms 101968 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 16220 KB Output is correct
2 Correct 6 ms 16220 KB Output is correct
3 Correct 5 ms 16216 KB Output is correct
4 Correct 4 ms 15964 KB Output is correct
5 Correct 7 ms 16208 KB Output is correct
6 Correct 8 ms 16220 KB Output is correct
7 Correct 5 ms 16216 KB Output is correct
8 Correct 5 ms 16220 KB Output is correct
9 Correct 7 ms 16220 KB Output is correct
10 Correct 7 ms 16256 KB Output is correct
11 Correct 7 ms 16268 KB Output is correct
12 Correct 7 ms 16220 KB Output is correct
13 Correct 7 ms 16272 KB Output is correct
14 Correct 7 ms 16220 KB Output is correct
15 Correct 8 ms 16220 KB Output is correct
16 Correct 7 ms 16264 KB Output is correct
17 Correct 6 ms 16260 KB Output is correct
18 Correct 6 ms 16220 KB Output is correct
19 Correct 4 ms 15964 KB Output is correct
20 Correct 4 ms 15964 KB Output is correct
21 Correct 7 ms 16220 KB Output is correct
22 Correct 7 ms 16220 KB Output is correct
23 Correct 5 ms 16220 KB Output is correct
24 Correct 5 ms 16052 KB Output is correct
25 Correct 7 ms 16220 KB Output is correct
26 Correct 7 ms 16164 KB Output is correct
27 Correct 7 ms 16220 KB Output is correct
28 Correct 6 ms 16072 KB Output is correct
29 Correct 10 ms 16220 KB Output is correct
30 Correct 7 ms 16220 KB Output is correct
31 Correct 8 ms 16220 KB Output is correct
32 Correct 7 ms 16220 KB Output is correct
33 Correct 4 ms 16140 KB Output is correct
34 Correct 4 ms 15964 KB Output is correct
35 Correct 5 ms 15964 KB Output is correct
36 Correct 4 ms 15984 KB Output is correct
37 Correct 5 ms 16220 KB Output is correct
38 Correct 5 ms 16220 KB Output is correct
39 Correct 4 ms 15964 KB Output is correct
40 Correct 5 ms 15964 KB Output is correct
41 Correct 6 ms 16216 KB Output is correct
42 Correct 5 ms 16220 KB Output is correct
43 Correct 4 ms 15964 KB Output is correct
44 Correct 5 ms 15964 KB Output is correct
45 Correct 7 ms 16220 KB Output is correct
46 Correct 5 ms 16220 KB Output is correct
47 Correct 5 ms 15964 KB Output is correct
48 Correct 5 ms 15964 KB Output is correct
49 Correct 6 ms 16220 KB Output is correct
50 Correct 6 ms 16220 KB Output is correct
51 Correct 5 ms 16220 KB Output is correct
52 Correct 5 ms 16220 KB Output is correct
53 Correct 6 ms 16220 KB Output is correct
54 Correct 6 ms 16236 KB Output is correct
55 Correct 5 ms 16220 KB Output is correct
56 Correct 5 ms 16220 KB Output is correct
57 Correct 5 ms 16216 KB Output is correct
58 Correct 5 ms 16220 KB Output is correct
59 Correct 6 ms 16220 KB Output is correct
60 Correct 6 ms 16220 KB Output is correct
61 Correct 3 ms 15964 KB Output is correct
62 Correct 4 ms 15964 KB Output is correct
63 Correct 3 ms 15944 KB Output is correct
64 Correct 153 ms 19988 KB Output is correct
65 Correct 109 ms 19036 KB Output is correct
66 Correct 77 ms 18728 KB Output is correct
67 Correct 24 ms 18008 KB Output is correct
68 Correct 154 ms 20076 KB Output is correct
69 Correct 112 ms 19036 KB Output is correct
70 Correct 85 ms 18768 KB Output is correct
71 Correct 63 ms 18524 KB Output is correct
72 Correct 160 ms 20944 KB Output is correct
73 Correct 143 ms 20572 KB Output is correct
74 Correct 141 ms 20408 KB Output is correct
75 Correct 140 ms 20444 KB Output is correct
76 Correct 159 ms 21260 KB Output is correct
77 Correct 165 ms 21408 KB Output is correct
78 Correct 157 ms 21268 KB Output is correct
79 Correct 162 ms 21260 KB Output is correct
80 Correct 148 ms 20088 KB Output is correct
81 Correct 108 ms 19036 KB Output is correct
82 Correct 75 ms 18740 KB Output is correct
83 Correct 24 ms 18008 KB Output is correct
84 Correct 147 ms 20048 KB Output is correct
85 Correct 114 ms 19548 KB Output is correct
86 Correct 80 ms 18520 KB Output is correct
87 Correct 66 ms 18524 KB Output is correct
88 Correct 157 ms 20940 KB Output is correct
89 Correct 143 ms 20664 KB Output is correct
90 Correct 139 ms 20388 KB Output is correct
91 Correct 134 ms 20268 KB Output is correct
92 Correct 165 ms 21492 KB Output is correct
93 Correct 167 ms 21260 KB Output is correct
94 Correct 159 ms 21260 KB Output is correct
95 Correct 177 ms 21564 KB Output is correct
96 Correct 24 ms 18008 KB Output is correct
97 Correct 23 ms 18012 KB Output is correct
98 Correct 25 ms 18012 KB Output is correct
99 Correct 24 ms 18012 KB Output is correct
100 Correct 67 ms 18592 KB Output is correct
101 Correct 50 ms 18264 KB Output is correct
102 Correct 60 ms 18552 KB Output is correct
103 Correct 25 ms 18008 KB Output is correct
104 Correct 139 ms 20048 KB Output is correct
105 Correct 99 ms 19012 KB Output is correct
106 Correct 69 ms 18520 KB Output is correct
107 Correct 26 ms 18248 KB Output is correct
108 Correct 142 ms 19688 KB Output is correct
109 Correct 106 ms 18960 KB Output is correct
110 Correct 73 ms 18560 KB Output is correct
111 Correct 27 ms 18268 KB Output is correct
112 Correct 64 ms 19540 KB Output is correct
113 Correct 81 ms 19660 KB Output is correct
114 Correct 66 ms 19540 KB Output is correct
115 Correct 86 ms 19828 KB Output is correct
116 Correct 64 ms 19560 KB Output is correct
117 Correct 80 ms 19536 KB Output is correct
118 Correct 63 ms 19536 KB Output is correct
119 Correct 80 ms 19800 KB Output is correct
120 Correct 64 ms 19540 KB Output is correct
121 Correct 81 ms 19520 KB Output is correct
122 Correct 114 ms 21264 KB Output is correct
123 Correct 111 ms 21156 KB Output is correct
124 Correct 93 ms 18780 KB Output is correct
125 Correct 75 ms 18268 KB Output is correct
126 Correct 71 ms 18264 KB Output is correct
127 Correct 98 ms 19024 KB Output is correct
128 Correct 74 ms 18448 KB Output is correct
129 Correct 72 ms 18316 KB Output is correct
130 Correct 102 ms 19248 KB Output is correct
131 Correct 75 ms 18264 KB Output is correct
132 Correct 71 ms 18264 KB Output is correct
133 Correct 794 ms 33604 KB Output is correct
134 Correct 588 ms 29004 KB Output is correct
135 Correct 413 ms 27608 KB Output is correct
136 Correct 124 ms 25408 KB Output is correct
137 Correct 778 ms 33508 KB Output is correct
138 Correct 602 ms 29012 KB Output is correct
139 Correct 418 ms 27720 KB Output is correct
140 Correct 297 ms 26404 KB Output is correct
141 Correct 840 ms 36660 KB Output is correct
142 Correct 764 ms 35068 KB Output is correct
143 Correct 751 ms 34752 KB Output is correct
144 Correct 757 ms 34952 KB Output is correct
145 Correct 868 ms 38200 KB Output is correct
146 Correct 870 ms 38324 KB Output is correct
147 Correct 853 ms 38324 KB Output is correct
148 Correct 861 ms 38252 KB Output is correct
149 Correct 776 ms 33472 KB Output is correct
150 Correct 587 ms 29036 KB Output is correct
151 Correct 407 ms 27584 KB Output is correct
152 Correct 122 ms 25416 KB Output is correct
153 Correct 795 ms 33416 KB Output is correct
154 Correct 588 ms 29032 KB Output is correct
155 Correct 405 ms 27212 KB Output is correct
156 Correct 285 ms 26448 KB Output is correct
157 Correct 834 ms 36532 KB Output is correct
158 Correct 768 ms 35004 KB Output is correct
159 Correct 733 ms 35008 KB Output is correct
160 Correct 709 ms 34428 KB Output is correct
161 Correct 823 ms 38268 KB Output is correct
162 Correct 841 ms 38056 KB Output is correct
163 Correct 842 ms 38392 KB Output is correct
164 Correct 826 ms 38224 KB Output is correct
165 Correct 88 ms 24648 KB Output is correct
166 Correct 90 ms 24724 KB Output is correct
167 Correct 89 ms 24652 KB Output is correct
168 Correct 89 ms 24648 KB Output is correct
169 Correct 305 ms 26624 KB Output is correct
170 Correct 244 ms 26184 KB Output is correct
171 Correct 217 ms 26052 KB Output is correct
172 Correct 111 ms 25104 KB Output is correct
173 Correct 723 ms 33184 KB Output is correct
174 Correct 540 ms 28960 KB Output is correct
175 Correct 367 ms 27052 KB Output is correct
176 Correct 122 ms 25112 KB Output is correct
177 Correct 756 ms 31272 KB Output is correct
178 Correct 543 ms 28132 KB Output is correct
179 Correct 404 ms 27096 KB Output is correct
180 Correct 125 ms 25160 KB Output is correct
181 Correct 296 ms 31260 KB Output is correct
182 Correct 395 ms 31420 KB Output is correct
183 Correct 284 ms 31164 KB Output is correct
184 Correct 397 ms 31420 KB Output is correct
185 Correct 289 ms 31384 KB Output is correct
186 Correct 402 ms 31396 KB Output is correct
187 Correct 291 ms 31336 KB Output is correct
188 Correct 416 ms 31632 KB Output is correct
189 Correct 291 ms 31328 KB Output is correct
190 Correct 404 ms 31164 KB Output is correct
191 Correct 520 ms 38372 KB Output is correct
192 Correct 516 ms 38124 KB Output is correct
193 Correct 2249 ms 103468 KB Output is correct
194 Correct 2288 ms 105348 KB Output is correct
195 Correct 4695 ms 193464 KB Output is correct
196 Correct 4685 ms 194088 KB Output is correct
197 Correct 5811 ms 230660 KB Output is correct
198 Correct 5788 ms 229628 KB Output is correct
199 Correct 5705 ms 118704 KB Output is correct
200 Correct 4487 ms 106640 KB Output is correct
201 Correct 4189 ms 104856 KB Output is correct
202 Correct 6489 ms 130736 KB Output is correct
203 Correct 4462 ms 106808 KB Output is correct
204 Correct 4152 ms 104332 KB Output is correct
205 Correct 6617 ms 133368 KB Output is correct
206 Correct 4499 ms 107344 KB Output is correct
207 Correct 4185 ms 104528 KB Output is correct
208 Correct 1996 ms 101520 KB Output is correct
209 Correct 1965 ms 101820 KB Output is correct
210 Correct 1984 ms 101784 KB Output is correct
211 Correct 2019 ms 101944 KB Output is correct
212 Correct 1999 ms 101968 KB Output is correct
213 Execution timed out 7056 ms 188140 KB Time limit exceeded
214 Halted 0 ms 0 KB -