제출 #339770

#제출 시각아이디문제언어결과실행 시간메모리
339770GioChkhaidzeSegments (IZhO18_segments)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; const int inf = 2e9 + 1; const int N = 2e5 + 5; const int Sq = 6666; unordered_map < int , int > G; vector < int > v[Sq][3]; int a[N][3], pr[N][3], c[N], A[N], L[Sq][3], R[Sq][3]; int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x; bool cmp1(int x, int y) { return a[x][tp] < a[y][tp]; } bool cmp2(int x, int y) { return c[x] < c[y]; } inline void Restart() { for (tp = 0; tp < 2; ++tp) { as = 0; for (bl = 0; bl < ms; ++bl) { for (j = 0; j < v[bl][tp].size(); ++j) A[as] = v[bl][tp][j], ++as; v[bl][tp].clear(); } if (as) sort(A , A + as, cmp1); for (j = 0; j < as; ++j) { v[(j / sq)][tp].push_back(A[j]); pr[A[j]][tp] = (j / sq); } for (bl = 0; bl < ms; ++bl) { if (!v[bl][tp].size()) continue; R[bl][tp] = -inf, L[bl][tp] = inf; sort(v[bl][tp].begin(), v[bl][tp].end(), cmp2); for (j = 0; j < v[bl][tp].size(); ++j) { y = a[v[bl][tp][j]][tp]; if (R[bl][tp] < y) R[bl][tp] = y; if (L[bl][tp] > y) L[bl][tp] = y; } } } } inline void p() { k = c[id], x = a[id][tp]; for (bl = 0; bl < ms; ++bl) if (!v[bl][tp].size() || x <= R[bl][tp]) { if (!v[bl][tp].size()) R[bl][tp] = L[bl][tp] = x; pr[id][tp] = bl; v[bl][tp].push_back(id); j = v[bl][tp].size()-1; while (0 < j && c[v[bl][tp][j-1]] > k) swap(v[bl][tp][j-1], v[bl][tp][j]), --j; if (x < L[bl][tp]) L[bl][tp] = x; return ; } } inline void d() { k = c[id], x = a[id][tp]; for (bl = 0; bl < ms; ++bl) if (pr[id][tp] == bl) { for (j = 0; j + 1 < v[bl][tp].size(); ++j) if (v[bl][tp][j] == id) swap(v[bl][tp][j], v[bl][tp][j + 1]); assert(v[bl][tp].back()==id); v[bl][tp].pop_back(); if (v[bl][tp].size()) { R[bl][tp] = -inf, L[bl][tp] = inf; for (j = 0; j < v[bl][tp].size(); ++j) { y = a[v[bl][tp][j]][tp]; if (R[bl][tp] < y) R[bl][tp] = y; if (L[bl][tp] > y) L[bl][tp] = y; } } return ; } } int br; int g(int l, int r, int k) { if (l > r) return 0; ret = 0; for (bl = 0; bl < ms; ++bl) { if (!v[bl][tp].size() || R[bl][tp] < l || r < L[bl][tp]) continue; if (l <= L[bl][tp] && R[bl][tp] <= r) { lo = 0, hi = v[bl][tp].size() - 1, res = 0; while (lo <= hi) { mid = ((lo + hi) >> 1); if (c[v[bl][tp][mid]] < k) res = lo = mid + 1; else hi = mid - 1; } ret += v[bl][tp].size() - res; } else { for (j = 0; j < v[bl][tp].size(); ++j) { id = v[bl][tp][j]; if (c[id] < k) continue; if (tp && a[id][1] <= r) ++ret; if (!tp && l <= a[id][0]) ++ret; } } } return ret; } void up(ll x) { while (x <= inf) { G[x] += del; x += (x & -x); } } int gt(ll x) { res = 0; while (x > 0) { res += G[x]; x -= (x & -x); } return res; } main () { scanf("%d %d",&n, &t); sq = sqrt(4*n); ms = (n - 1 + sq - 1) / sq; int lastans = 0, ans = 0, cnt = 0, u = 0, idx, ty, X, Y, Z, A, B, C; for (int i = 0; i < n; ++i) { if (!(i % sq)) Restart(); scanf("%d",&ty); if (ty == 1) { id = ++u, ++cnt; scanf("%d %d",&a[u][0], &a[u][1]); a[u][0] = (a[u][0] ^ (t * lastans)); a[u][1] = (a[u][1] ^ (t * lastans)); if (a[u][0] > a[u][1]) swap(a[u][0], a[u][1]); c[u] = (a[u][1] - a[u][0] + 1); tp = 0, p(); tp = 1, p(); del = 1, up(c[u]); } else if (ty == 2) { scanf("%d",&idx); --cnt, id = idx; tp = 0, d(); tp = 1, d(); del = -1, up(c[id]); } else if (ty == 3) { scanf("%d %d %d",&A, &B, &C); A = (A ^ (t * lastans)); B = (B ^ (t * lastans)); if (A > B) swap(A, B); if (B - A + 1 < C) lastans = ans = 0; else { tp = 0, X = g(B - C + 2, 2e9, C); tp = 1, Y = g(0, A + C - 2, C); Z = gt(C - 1); lastans = ans = cnt - (X + Y + Z); } printf("%d\n",ans); } } }#include <bits/stdc++.h> #define ll long long using namespace std; const int inf = 2e9 + 1; const int N = 2e5 + 5; const int Sq = 6666; map < int , int > G; vector < int > v[Sq][3]; int a[N][3], pr[N][3], c[N], A[N], L[Sq][3], R[Sq][3]; int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x; bool cmp1(int x, int y) { return a[x][tp] < a[y][tp]; } bool cmp2(int x, int y) { return c[x] < c[y]; } inline void Restart() { for (tp = 0; tp < 2; ++tp) { as = 0; for (bl = 0; bl < ms; ++bl) { for (j = 0; j < v[bl][tp].size(); ++j) A[as] = v[bl][tp][j], ++as; v[bl][tp].clear(); } if (as) sort(A , A + as, cmp1); for (j = 0; j < as; ++j) { v[(j / sq)][tp].push_back(A[j]); pr[A[j]][tp] = (j / sq); } for (bl = 0; bl < ms; ++bl) { if (!v[bl][tp].size()) continue; R[bl][tp] = -inf, L[bl][tp] = inf; sort(v[bl][tp].begin(), v[bl][tp].end(), cmp2); for (j = 0; j < v[bl][tp].size(); ++j) { y = a[v[bl][tp][j]][tp]; if (R[bl][tp] < y) R[bl][tp] = y; if (L[bl][tp] > y) L[bl][tp] = y; } } } } inline void p() { k = c[id], x = a[id][tp]; for (bl = 0; bl < ms; ++bl) if (!v[bl][tp].size() || x <= R[bl][tp]) { if (!v[bl][tp].size()) R[bl][tp] = L[bl][tp] = x; pr[id][tp] = bl; v[bl][tp].push_back(id); j = v[bl][tp].size()-1; while (0 < j && c[v[bl][tp][j-1]] > k) swap(v[bl][tp][j-1], v[bl][tp][j]), --j; if (x < L[bl][tp]) L[bl][tp] = x; return ; } } inline void d() { k = c[id], x = a[id][tp]; for (bl = 0; bl < ms; ++bl) if (pr[id][tp] == bl) { for (j = 0; j + 1 < v[bl][tp].size(); ++j) if (v[bl][tp][j] == id) swap(v[bl][tp][j], v[bl][tp][j + 1]); assert(v[bl][tp].back()==id); v[bl][tp].pop_back(); if (v[bl][tp].size()) { R[bl][tp] = -inf, L[bl][tp] = inf; for (j = 0; j < v[bl][tp].size(); ++j) { y = a[v[bl][tp][j]][tp]; if (R[bl][tp] < y) R[bl][tp] = y; if (L[bl][tp] > y) L[bl][tp] = y; } } return ; } } int br; int g(int l, int r, int k) { if (l > r) return 0; ret = 0; for (bl = 0; bl < ms; ++bl) { if (!v[bl][tp].size() || R[bl][tp] < l || r < L[bl][tp]) continue; if (l <= L[bl][tp] && R[bl][tp] <= r) { lo = 0, hi = v[bl][tp].size() - 1, res = 0; while (lo <= hi) { mid = ((lo + hi) >> 1); if (c[v[bl][tp][mid]] < k) res = lo = mid + 1; else hi = mid - 1; } ret += v[bl][tp].size() - res; } else { for (j = 0; j < v[bl][tp].size(); ++j) { id = v[bl][tp][j]; if (c[id] < k) continue; if (tp && a[id][1] <= r) ++ret; if (!tp && l <= a[id][0]) ++ret; } } } return ret; } void up(ll x) { while (x <= inf) { G[x] += del; x += (x & -x); } } int gt(ll x) { res = 0; while (x > 0) { res += G[x]; x -= (x & -x); } return res; } main () { scanf("%d %d",&n, &t); sq = sqrt(4*n); ms = (n - 1 + sq - 1) / sq; int lastans = 0, ans = 0, cnt = 0, u = 0, idx, ty, X, Y, Z, A, B, C; for (int i = 0; i < n; ++i) { if (!(i % sq)) Restart(); scanf("%d",&ty); if (ty == 1) { id = ++u, ++cnt; scanf("%d %d",&a[u][0], &a[u][1]); a[u][0] = (a[u][0] ^ (t * lastans)); a[u][1] = (a[u][1] ^ (t * lastans)); if (a[u][0] > a[u][1]) swap(a[u][0], a[u][1]); c[u] = (a[u][1] - a[u][0] + 1); tp = 0, p(); tp = 1, p(); del = 1, up(c[u]); } else if (ty == 2) { scanf("%d",&idx); --cnt, id = idx; tp = 0, d(); tp = 1, d(); del = -1, up(c[id]); } else if (ty == 3) { scanf("%d %d %d",&A, &B, &C); A = (A ^ (t * lastans)); B = (B ^ (t * lastans)); if (A > B) swap(A, B); if (B - A + 1 < C) lastans = ans = 0; else { tp = 0, X = g(B - C + 2, 2e9, C); tp = 1, Y = g(0, A + C - 2, C); Z = gt(C - 1); lastans = ans = cnt - (X + Y + Z); } printf("%d\n",ans); } } }

컴파일 시 표준 에러 (stderr) 메시지

segments.cpp:174:2: error: stray '#' in program
  174 | }#include <bits/stdc++.h>
      |  ^
segments.cpp: In function 'void Restart()':
segments.cpp:28:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |    for (j = 0; j < v[bl][tp].size(); ++j)
      |                ~~^~~~~~~~~~~~~~~~~~
segments.cpp:43:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |    for (j = 0; j < v[bl][tp].size(); ++j) {
      |                ~~^~~~~~~~~~~~~~~~~~
segments.cpp: In function 'void d()':
segments.cpp:71:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   71 |    for (j = 0; j + 1 < v[bl][tp].size(); ++j)
      |                ~~~~~~^~~~~~~~~~~~~~~~~~
segments.cpp:77:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   77 |     for (j = 0; j < v[bl][tp].size(); ++j) {
      |                 ~~^~~~~~~~~~~~~~~~~~
segments.cpp: In function 'int g(int, int, int)':
segments.cpp:105:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  105 |    for (j = 0; j < v[bl][tp].size(); ++j) {
      |                ~~^~~~~~~~~~~~~~~~~~
segments.cpp: At global scope:
segments.cpp:132:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
  132 | main () {
      |       ^
segments.cpp:174:3: error: 'include' does not name a type
  174 | }#include <bits/stdc++.h>
      |   ^~~~~~~
segments.cpp:180:11: error: redefinition of 'const int inf'
  180 | const int inf = 2e9 + 1;
      |           ^~~
segments.cpp:7:11: note: 'const int inf' previously defined here
    7 | const int inf = 2e9 + 1;
      |           ^~~
segments.cpp:181:11: error: redefinition of 'const int N'
  181 | const int N = 2e5 + 5;
      |           ^
segments.cpp:8:11: note: 'const int N' previously defined here
    8 | const int N = 2e5 + 5;
      |           ^
segments.cpp:182:11: error: redefinition of 'const int Sq'
  182 | const int Sq = 6666;
      |           ^~
segments.cpp:9:11: note: 'const int Sq' previously defined here
    9 | const int Sq = 6666;
      |           ^~
segments.cpp:184:19: error: conflicting declaration 'std::map<int, int> G'
  184 | map < int , int > G;
      |                   ^
segments.cpp:11:29: note: previous declaration as 'std::unordered_map<int, int> G'
   11 | unordered_map < int , int > G;
      |                             ^
segments.cpp:185:16: error: redefinition of 'std::vector<int> v [6666][3]'
  185 | vector < int > v[Sq][3];
      |                ^
segments.cpp:12:16: note: 'std::vector<int> v [6666][3]' previously declared here
   12 | vector < int > v[Sq][3];
      |                ^
segments.cpp:186:5: error: redefinition of 'int a [200005][3]'
  186 | int a[N][3], pr[N][3], c[N], A[N], L[Sq][3], R[Sq][3];
      |     ^
segments.cpp:13:5: note: 'int a [200005][3]' previously declared here
   13 | int a[N][3], pr[N][3], c[N], A[N], L[Sq][3], R[Sq][3];
      |     ^
segments.cpp:186:14: error: redefinition of 'int pr [200005][3]'
  186 | int a[N][3], pr[N][3], c[N], A[N], L[Sq][3], R[Sq][3];
      |              ^~
segments.cpp:13:14: note: 'int pr [200005][3]' previously declared here
   13 | int a[N][3], pr[N][3], c[N], A[N], L[Sq][3], R[Sq][3];
      |              ^~
segments.cpp:186:24: error: redefinition of 'int c [200005]'
  186 | int a[N][3], pr[N][3], c[N], A[N], L[Sq][3], R[Sq][3];
      |                        ^
segments.cpp:13:24: note: 'int c [200005]' previously declared here
   13 | int a[N][3], pr[N][3], c[N], A[N], L[Sq][3], R[Sq][3];
      |                        ^
segments.cpp:186:30: error: redefinition of 'int A [200005]'
  186 | int a[N][3], pr[N][3], c[N], A[N], L[Sq][3], R[Sq][3];
      |                              ^
segments.cpp:13:30: note: 'int A [200005]' previously declared here
   13 | int a[N][3], pr[N][3], c[N], A[N], L[Sq][3], R[Sq][3];
      |                              ^
segments.cpp:186:36: error: redefinition of 'int L [6666][3]'
  186 | int a[N][3], pr[N][3], c[N], A[N], L[Sq][3], R[Sq][3];
      |                                    ^
segments.cpp:13:36: note: 'int L [6666][3]' previously declared here
   13 | int a[N][3], pr[N][3], c[N], A[N], L[Sq][3], R[Sq][3];
      |                                    ^
segments.cpp:186:46: error: redefinition of 'int R [6666][3]'
  186 | int a[N][3], pr[N][3], c[N], A[N], L[Sq][3], R[Sq][3];
      |                                              ^
segments.cpp:13:46: note: 'int R [6666][3]' previously declared here
   13 | int a[N][3], pr[N][3], c[N], A[N], L[Sq][3], R[Sq][3];
      |                                              ^
segments.cpp:187:5: error: redefinition of 'int n'
  187 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |     ^
segments.cpp:14:5: note: 'int n' previously declared here
   14 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |     ^
segments.cpp:187:8: error: redefinition of 'int t'
  187 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |        ^
segments.cpp:14:8: note: 'int t' previously declared here
   14 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |        ^
segments.cpp:187:11: error: redefinition of 'int tot'
  187 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |           ^~~
segments.cpp:14:11: note: 'int tot' previously declared here
   14 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |           ^~~
segments.cpp:187:16: error: redefinition of 'int del'
  187 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                ^~~
segments.cpp:14:16: note: 'int del' previously declared here
   14 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                ^~~
segments.cpp:187:21: error: redefinition of 'int mid'
  187 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                     ^~~
segments.cpp:14:21: note: 'int mid' previously declared here
   14 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                     ^~~
segments.cpp:187:26: error: redefinition of 'int res'
  187 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                          ^~~
segments.cpp:14:26: note: 'int res' previously declared here
   14 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                          ^~~
segments.cpp:187:31: error: redefinition of 'int ret'
  187 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                               ^~~
segments.cpp:14:31: note: 'int ret' previously declared here
   14 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                               ^~~
segments.cpp:187:36: error: redefinition of 'int lo'
  187 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                                    ^~
segments.cpp:14:36: note: 'int lo' previously declared here
   14 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                                    ^~
segments.cpp:187:40: error: redefinition of 'int hi'
  187 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                                        ^~
segments.cpp:14:40: note: 'int hi' previously declared here
   14 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                                        ^~
segments.cpp:187:44: error: redefinition of 'int sq'
  187 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                                            ^~
segments.cpp:14:44: note: 'int sq' previously declared here
   14 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                                            ^~
segments.cpp:187:48: error: redefinition of 'int ms'
  187 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                                                ^~
segments.cpp:14:48: note: 'int ms' previously declared here
   14 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                                                ^~
segments.cpp:187:52: error: redefinition of 'int as'
  187 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                                                    ^~
segments.cpp:14:52: note: 'int as' previously declared here
   14 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                                                    ^~
segments.cpp:187:56: error: redefinition of 'int tp'
  187 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                                                        ^~
segments.cpp:14:56: note: 'int tp' previously declared here
   14 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                                                        ^~
segments.cpp:187:60: error: redefinition of 'int id'
  187 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                                                            ^~
segments.cpp:14:60: note: 'int id' previously declared here
   14 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                                                            ^~
segments.cpp:187:64: error: redefinition of 'int y'
  187 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                                                                ^
segments.cpp:14:64: note: 'int y' previously declared here
   14 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                                                                ^
segments.cpp:187:67: error: redefinition of 'int bl'
  187 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                                                                   ^~
segments.cpp:14:67: note: 'int bl' previously declared here
   14 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                                                                   ^~
segments.cpp:187:71: error: redefinition of 'int j'
  187 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                                                                       ^
segments.cpp:14:71: note: 'int j' previously declared here
   14 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                                                                       ^
segments.cpp:187:74: error: redefinition of 'int k'
  187 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                                                                          ^
segments.cpp:14:74: note: 'int k' previously declared here
   14 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                                                                          ^
segments.cpp:187:77: error: redefinition of 'int x'
  187 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                                                                             ^
segments.cpp:14:77: note: 'int x' previously declared here
   14 | int n, t, tot, del, mid, res, ret, lo, hi, sq, ms, as, tp, id, y, bl, j, k, x;
      |                                                                             ^
segments.cpp:189:6: error: redefinition of 'bool cmp1(int, int)'
  189 | bool cmp1(int x, int y) {
      |      ^~~~
segments.cpp:16:6: note: 'bool cmp1(int, int)' previously defined here
   16 | bool cmp1(int x, int y) {
      |      ^~~~
segments.cpp:193:6: error: redefinition of 'bool cmp2(int, int)'
  193 | bool cmp2(int x, int y) {
      |      ^~~~
segments.cpp:20:6: note: 'bool cmp2(int, int)' previously defined here
   20 | bool cmp2(int x, int y) {
      |      ^~~~
segments.cpp:197:13: error: redefinition of 'void Restart()'
  197 | inline void Restart() {
      |             ^~~~~~~
segments.cpp:24:13: note: 'void Restart()' previously defined here
   24 | inline void Restart() {
      |             ^~~~~~~
segments.cpp: In function 'void Restart()':
segments.cpp:201:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  201 |    for (j = 0; j < v[bl][tp].size(); ++j)
      |                ~~^~~~~~~~~~~~~~~~~~
segments.cpp:216:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  216 |    for (j = 0; j < v[bl][tp].size(); ++j) {
      |                ~~^~~~~~~~~~~~~~~~~~
segments.cpp: At global scope:
segments.cpp:225:13: error: redefinition of 'void p()'
  225 | inline void p() {
      |             ^
segments.cpp:52:13: note: 'void p()' previously defined here
   52 | inline void p() {
      |             ^
segments.cpp:240:13: error: redefinition of 'void d()'
  240 | inline void d() {
      |             ^
segments.cpp:67:13: note: 'void d()' previously defined here
   67 | inline void d() {
      |             ^
segments.cpp: In function 'void d()':
segments.cpp:244:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  244 |    for (j = 0; j + 1 < v[bl][tp].size(); ++j)
      |                ~~~~~~^~~~~~~~~~~~~~~~~~
segments.cpp:250:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  250 |     for (j = 0; j < v[bl][tp].size(); ++j) {
      |                 ~~^~~~~~~~~~~~~~~~~~
segments.cpp: At global scope:
segments.cpp:260:5: error: redefinition of 'int br'
  260 | int br;
      |     ^~
segments.cpp:87:5: note: 'int br' previously declared here
   87 | int br;
      |     ^~
segments.cpp:261:5: error: redefinition of 'int g(int, int, int)'
  261 | int g(int l, int r, int k) {
      |     ^
segments.cpp:88:5: note: 'int g(int, int, int)' previously defined here
   88 | int g(int l, int r, int k) {
      |     ^
segments.cpp: In function 'int g(int, int, int)':
segments.cpp:278:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  278 |    for (j = 0; j < v[bl][tp].size(); ++j) {
      |                ~~^~~~~~~~~~~~~~~~~~
segments.cpp: At global scope:
segments.cpp:289:6: error: redefinition of 'void up(long long int)'
  289 | void up(ll x) {
      |      ^~
segments.cpp:116:6: note: 'void up(long long int)' previously defined here
  116 | void up(ll x) {
      |      ^~
segments.cpp:296:5: error: redefinition of 'int gt(long long int)'
  296 | int gt(ll x) {
      |     ^~
segments.cpp:123:5: note: 'int gt(long long int)' previously defined here
  123 | int gt(ll x) {
      |     ^~
segments.cpp:305:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
  305 | main () {
      |       ^
segments.cpp:305:1: error: redefinition of 'int main()'
  305 | main () {
      | ^~~~
segments.cpp:132:1: note: 'int main()' previously defined here
  132 | main () {
      | ^~~~
segments.cpp: In function 'int main()':
segments.cpp:133:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  133 |  scanf("%d %d",&n, &t);
      |  ~~~~~^~~~~~~~~~~~~~~~
segments.cpp:139:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  139 |   scanf("%d",&ty);
      |   ~~~~~^~~~~~~~~~
segments.cpp:142:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  142