This documentation is automatically generated by online-judge-tools/verification-helper
#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/courses/library/3/DSL/2/DSL_2_F"
#include "../../data_structure/lazy_segtree.hpp"
#include <bits/stdc++.h>
using namespace std;
int main() {
ll n, q;
cin >> n >> q;
vector<ll> src(n, INT_MAX);
lazy_segtree<min_monoid_with_update> lst(src);
while (q--) {
ll com;
cin >> com;
if (com == 0) {
ll s, t, x;
cin >> s >> t >> x;
lst.apply(s, t + 1, x);
} else if (com == 1) {
ll s, t;
cin >> s >> t;
cout << lst.prod(s, t + 1) << endl;
}
}
}
#line 1 "test/onlinejudge.u-aizu.ac.jp/RMQ_and_RUQ.0.test.cpp"
#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/courses/library/3/DSL/2/DSL_2_F"
#line 2 "data_structure/lazy_segtree.hpp"
#line 2 "template.hpp"
#include <bits/stdc++.h>
using namespace std;
#define all(a) begin(a), end(a)
#define rall(a) rbegin(a), rend(a)
#define uniq(a) (a).erase(unique(all(a)), (a).end())
#define t0 first
#define t1 second
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;
using vll = vector<ll>;
constexpr double pi = 3.14159265358979323846;
constexpr ll dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
constexpr ll dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
constexpr ll sign(ll a) { return (a > 0) - (a < 0); }
constexpr ll fdiv(ll a, ll b) { return a / b - ((a ^ b) < 0 && a % b); }
constexpr ll cdiv(ll a, ll b) { return -fdiv(-a, b); }
constexpr ll pw(ll n) { return 1ll << n; }
constexpr ll flg(ll n) { return 63 - __builtin_clzll(n); }
constexpr ll clg(ll n) { return n == 1 ? 0 : flg(n - 1) + 1; }
constexpr ll safemod(ll x, ll mod) { return (x % mod + mod) % mod; }
template <typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
template <typename T> constexpr T sq(const T &a) { return a * a; }
template <typename T, typename U> constexpr bool chmax(T &a, const U &b) { return a < b ? a = b, true : false; }
template <typename T, typename U> constexpr bool chmin(T &a, const U &b) { return a > b ? a = b, true : false; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &a) {
os << "(" << a.first << ", " << a.second << ")";
return os;
}
template <typename T, typename U, typename V> ostream &operator<<(ostream &os, const tuple<T, U, V> &a) {
os << "(" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ")";
return os;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &a) {
os << "(";
for (auto itr = a.begin(); itr != a.end(); ++itr) os << *itr << (next(itr) != a.end() ? ", " : "");
os << ")";
return os;
}
template <typename T> ostream &operator<<(ostream &os, const set<T> &a) {
os << "(";
for (auto itr = a.begin(); itr != a.end(); ++itr) os << *itr << (next(itr) != a.end() ? ", " : "");
os << ")";
return os;
}
template <typename T> ostream &operator<<(ostream &os, const multiset<T> &a) {
os << "(";
for (auto itr = a.begin(); itr != a.end(); ++itr) os << *itr << (next(itr) != a.end() ? ", " : "");
os << ")";
return os;
}
template <typename T, typename U> ostream &operator<<(ostream &os, const map<T, U> &a) {
os << "(";
for (auto itr = a.begin(); itr != a.end(); ++itr) os << *itr << (next(itr) != a.end() ? ", " : "");
os << ")";
return os;
}
#ifdef ONLINE_JUDGE
#define dump(...) (void(0))
#else
void debug() { cerr << endl; }
template <typename Head, typename... Tail> void debug(Head &&head, Tail &&... tail) {
cerr << head;
if (sizeof...(Tail)) cerr << ", ";
debug(tail...);
}
#define dump(...) cerr << __LINE__ << ": " << #__VA_ARGS__ << " = ", debug(__VA_ARGS__)
#endif
struct rep {
struct itr {
ll v;
itr(ll v) : v(v) {}
void operator++() { ++v; }
ll operator*() const { return v; }
bool operator!=(itr i) const { return v < *i; }
};
ll l, r;
rep(ll l, ll r) : l(l), r(r) {}
rep(ll r) : rep(0, r) {}
itr begin() const { return l; };
itr end() const { return r; };
};
struct per {
struct itr {
ll v;
itr(ll v) : v(v) {}
void operator++() { --v; }
ll operator*() const { return v; }
bool operator!=(itr i) const { return v > *i; }
};
ll l, r;
per(ll l, ll r) : l(l), r(r) {}
per(ll r) : per(0, r) {}
itr begin() const { return r - 1; };
itr end() const { return l - 1; };
};
struct io_setup {
static constexpr int PREC = 20;
io_setup() {
cout << fixed << setprecision(PREC);
cerr << fixed << setprecision(PREC);
};
} iOS;
#line 4 "data_structure/lazy_segtree.hpp"
template <typename P> struct lazy_segtree {
using V = typename P::V;
using F = typename P::F;
ll n, size;
vector<V> val;
vector<F> lazy;
lazy_segtree(ll n) : lazy_segtree(vector(n, P::e())) {}
lazy_segtree(const vector<V> &src) : n(src.size()) {
size = pw(clg(n));
val.resize(size << 1, P::e());
copy(all(src), val.begin() + size);
lazy.resize(size << 1, P::id());
for (ll i : per(1, size)) val[i] = P::op(val[i << 1 | 0], val[i << 1 | 1]);
}
V reflect(ll i) { return P::mapping(lazy[i], val[i]); }
void push(ll i) {
val[i] = P::mapping(lazy[i], val[i]);
lazy[i << 1 | 0] = P::composition(lazy[i], lazy[i << 1 | 0]);
lazy[i << 1 | 1] = P::composition(lazy[i], lazy[i << 1 | 1]);
lazy[i] = P::id();
}
void thrust(ll i) {
for (ll j = flg(n); j; j--) push(i >> j);
}
void recalc(ll i) {
while (i >>= 1) val[i] = P::op(reflect(i << 1 | 0), reflect(i << 1 | 1));
}
void set(ll i, const V &a) {
thrust(i += size);
val[i] = a;
lazy[i] = P::id();
recalc(i);
}
void apply(ll l, ll r, F f) {
if (l >= r) return;
thrust(l += size);
thrust(r += size - 1);
for (ll i = l, j = r + 1; i < j; i >>= 1, j >>= 1) {
if (i & 1) lazy[i] = P::composition(f, lazy[i]), ++i;
if (j & 1) --j, lazy[j] = P::composition(f, lazy[j]);
}
recalc(l);
recalc(r);
}
V get(ll i) {
thrust(i += size);
return reflect(i);
}
V prod(ll l, ll r) {
if (l >= r) return P::e();
thrust(l += size);
thrust(r += size - 1);
V a = P::e(), b = P::e();
for (++r; l < r; l >>= 1, r >>= 1) {
if (l & 1) a = P::op(a, reflect(l++));
if (r & 1) b = P::op(reflect(--r), b);
}
return P::op(a, b);
}
template <typename G> ll max_right(ll l, G g) {
if (l == n) return n;
thrust(l += size);
V a = P::e();
do {
while (~l & 1) l >>= 1;
if (!g(P::op(a, reflect(l)))) {
while (l < size) {
push(l);
l = l << 1 | 0;
if (g(P::op(a, reflect(l)))) a = P::op(a, reflect(l++));
}
return l - size;
}
a = P::op(a, reflect(l++));
} while ((l & -l) != l);
return n;
}
template <typename G> ll min_left(ll r, G g) {
if (r == 0) return 0;
thrust((r += size) - 1);
V a = P::e();
do {
--r;
while (r > 1 && r & 1) r >>= 1;
if (!g(P::op(reflect(r), a))) {
while (r < size) {
push(r);
r = r << 1 | 1;
if (g(P::op(reflect(r), a))) a = P::op(reflect(r--), a);
}
return r + 1 - size;
}
a = P::op(reflect(r), a);
} while ((r & -r) != r);
return 0;
}
};
struct min_monoid_with_addition {
using V = ll;
using F = ll;
static V op(V a, V b) { return min(a, b); }
static V e() { return LLONG_MAX; }
static V mapping(F f, V a) { return a == e() ? a : f + a; }
static F composition(F f, F g) { return f + g; }
static F id() { return 0; }
};
struct min_monoid_with_update {
using V = ll;
using F = ll;
static V op(V a, V b) { return min(a, b); }
static V e() { return LLONG_MAX; }
static V mapping(F f, V a) { return f == id() ? a : f; }
static F composition(F f, F g) { return f == id() ? g : f; }
static F id() { return -1; };
};
struct sum_monoid_with_addition {
using V = pair<ll, ll>;
using F = ll;
static V op(V a, V b) { return {a.first + b.first, a.second + b.second}; }
static V e() { return {0, 0}; }
static V mapping(F f, V a) { return {a.first + f * a.second, a.second}; }
static F composition(F f, F g) { return f + g; }
static F id() { return 0; };
};
struct sum_monoid_with_update {
using V = pair<ll, ll>;
using F = ll;
static V op(V a, V b) { return {a.first + b.first, a.second + b.second}; }
static V e() { return {0, 0}; }
static V mapping(F f, V a) { return f == id() ? a : make_pair(f * a.second, a.second); }
static F composition(F f, F g) { return f == id() ? g : f; }
static F id() { return LLONG_MIN; };
};
template <typename T> struct sum_monoid_with_affine {
using V = pair<T, ll>;
using F = pair<T, T>;
static V op(V a, V b) { return {a.first + b.first, a.second + b.second}; }
static V e() { return {0, 0}; }
static V mapping(F f, V a) { return {f.first * a.first + f.second * a.second, a.second}; }
static F composition(F f, F g) { return {f.first * g.first, f.second + f.first * g.second}; }
static F id() { return {1, 0}; };
};
#line 3 "test/onlinejudge.u-aizu.ac.jp/RMQ_and_RUQ.0.test.cpp"
#line 5 "test/onlinejudge.u-aizu.ac.jp/RMQ_and_RUQ.0.test.cpp"
using namespace std;
int main() {
ll n, q;
cin >> n >> q;
vector<ll> src(n, INT_MAX);
lazy_segtree<min_monoid_with_update> lst(src);
while (q--) {
ll com;
cin >> com;
if (com == 0) {
ll s, t, x;
cin >> s >> t >> x;
lst.apply(s, t + 1, x);
} else if (com == 1) {
ll s, t;
cin >> s >> t;
cout << lst.prod(s, t + 1) << endl;
}
}
}