#include #include #include #include #include #include #include #include #include #include #define in cin #define out cout #define abs(x) ((x>0)?(x):(-(x))) #define max(a,b) ((a)>(b)?(a):(b)) #define min(a,b) ((a)<(b)?(a):(b)) #define FOR(i, a, b) for(int i = a; i <= b; ++i) #define DOWNFOR(i, a, b) for(int i = a; i >= b; --i) #define FOREACH(i, t) for (typeof(t.begin()) i = t.begin(); i != t.end(); ++i) using namespace std; typedef long long ll; const int Nmax = 100001; struct aint { int val, lz; aint() { val = lz = 0; } } A[4 * Nmax]; int N, M; void flipsons(int i, int st, int dr) { int mij = (st + dr) / 2; A[2 * i].val = (mij - st + 1) - A[2 * i].val; A[2 * i].lz = !A[2 * i].lz; A[2 * i + 1].val = (dr - mij) - A[2 * i + 1].val; A[2 * i + 1].lz = !A[2 * i + 1].lz; } void update(int i, int st, int dr, int a, int b) { if (A[i].lz) { if (stmij) update(2 * i + 1, mij + 1, dr, a, b); else { update(2 * i, st, mij, a, mij); update(2 * i + 1, mij + 1, dr, mij + 1, b); } A[i].val = A[2 * i].val + A[2 * i + 1].val; } } int query(int i, int st, int dr, int a, int b) { if (A[i].lz) { if (stmij) return query(2 * i + 1, mij + 1, dr, a, b); else { int xa = query(2 * i, st, mij, a, mij); int xb = query(2 * i + 1, mij + 1, dr, mij + 1, b); return xa + xb; } } } void Query(int x) { int p = query(1, 1, N, x, x); int i = x, pas = 1 << 19; while (pas) { if (i + pas <= N && query(1, 1, N, i, i + pas) == p*(pas + 1)) i += pas; pas >>= 1; } int b = i; i = x, pas = 1 << 19; while (pas) { if (i - pas >= 1 && query(1, 1, N, i - pas, i) == p*(pas + 1)) i -= pas; pas >>= 1; } int a = i; out << p << ' ' << a << ' ' << b << '\n'; } int main() { #ifndef ONLINE_JUDGE ifstream in("test.in"); ofstream out("test.out"); #endif in >> N >> M; for (int i = 1; i <= M; i++) { int t, x, y; in >> t; if (t == 1) { in >> x >> y; update(1, 1, N, x, y); } else { in >> x; } } return 0; }