#pragma GCC optimize ("O3") #pragma GCC target ("avx") #include "bits/stdc++.h" // define macro "/D__MAI" using namespace std; typedef long long int ll; #define xprintf(fmt,...) fprintf(stderr,fmt,__VA_ARGS__) #define debugv(v) {printf("L%d %s => ",__LINE__,#v);for(auto e:v){cout< ",__LINE__,#m);for(int x=0;x<(w);x++){cout<<(m)[x]<<" ";}cout< ostream& operator <<(ostream &o, const pair p) { o << "(" << p.first << ":" << p.second << ")"; return o; } mt19937 mt(8901016); inline int rand_int(int l, int h) { return uniform_int_distribution<>(l, h)(mt); } #ifdef __MAI #define getchar_unlocked getchar #define putchar_unlocked putchar #endif #ifdef __VSCC #define getchar_unlocked _getchar_nolock #define putchar_unlocked _putchar_nolock #endif namespace { #define isvisiablechar(c) (0x21<=(c)&&(c)<=0x7E) class MaiScanner { public: template void input_integer(T& var) { var = 0; T sign = 1; int cc = getchar_unlocked(); for (; cc<'0' || '9'>(int& var) { input_integer(var); return *this; } inline MaiScanner& operator>>(long long& var) { input_integer(var); return *this; } inline MaiScanner& operator>>(string& var) { int cc = getchar_unlocked(); for (; !isvisiablechar(cc); cc = getchar_unlocked()); for (; isvisiablechar(cc); cc = getchar_unlocked()) var.push_back(cc); } template void in(IT begin, IT end) { for (auto it = begin; it != end; ++it) *this >> *it; } }; } MaiScanner scanner; ll square_detail[1010][1010]; ll square[1010]; ll square_1[1010]; ll square_2[1010]; void check_cell_before(int idx) { if (square[idx] == 2) { repeat(i, 1000) { square_detail[idx][i] = 1; } square_1[idx] = 1000; square_2[idx] = 0; } else if (square[idx] == 4) { repeat(i, 1000) { square_detail[idx][i] = 2; } square_1[idx] = 0; square_2[idx] = 1000; } } void check_cell_after(int idx) { int ext = 0; square_1[idx] = 0; square_2[idx] = 0; repeat(i, 1000) { ext |= 1<> n >> n_q; // ちくしょう!setvalrange関数が無い! // segtree field(n); ll total_1 = 0; ll total_2 = 0; repeat(qi, n_q) { int x, l, r; scanner >> x >> l >> r; if (x == 0) { attack_chance(l, r); if (bonus_1 < bonus_2) total_2 += bonus_2; else if (bonus_1 > bonus_2) total_1 += bonus_1; bonus_1 = bonus_2 = 0; } else { update_square(l, r, x); } } attack_chance(0, n); total_1 += bonus_1; total_2 += bonus_2; printf("%lld %lld\n", total_1, total_2); return 0; }