QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#716437 | #6733. Moniphant Sleep | MiniLong | TL | 1ms | 5760kb | C++20 | 2.9kb | 2024-11-06 15:16:39 | 2024-11-06 15:16:39 |
Judging History
answer
#include <bits/stdc++.h>
#define _rep(i, x, y) for(int i = x; i <= y; ++i)
#define _req(i, x, y) for(int i = x; i >= y; --i)
#define _rev(i, u) for(int i = head[u]; i; i = e[i].nxt)
#define pb push_back
#define fi first
#define se second
#define mst(f, i) memset(f, i, sizeof f)
using namespace std;
#ifdef ONLINE_JUDGE
#define debug(...) 0
#else
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#endif
typedef long long ll;
typedef pair<int, int> PII;
namespace fastio{
#ifdef ONLINE_JUDGE
char ibuf[1 << 20],*p1 = ibuf, *p2 = ibuf;
#define get() p1 == p2 && (p2 = (p1 = ibuf) + fread(ibuf, 1, 1 << 20, stdin), p1 == p2) ? EOF : *p1++
#else
#define get() getchar()
#endif
template<typename T> inline void read(T &t){
T x = 0, f = 1;
char c = getchar();
while(!isdigit(c)){
if(c == '-') f = -f;
c = getchar();
}
while(isdigit(c)) x = x * 10 + c - '0', c = getchar();
t = x * f;
}
template<typename T, typename ... Args> inline void read(T &t, Args&... args){
read(t);
read(args...);
}
template<typename T> void write(T t){
if(t < 0) putchar('-'), t = -t;
if(t >= 10) write(t / 10);
putchar(t % 10 + '0');
}
template<typename T, typename ... Args> void write(T t, Args... args){
write(t), putchar(' '), write(args...);
}
template<typename T> void writeln(T t){
write(t);
puts("");
}
template<typename T> void writes(T t){
write(t), putchar(' ');
}
#undef get
};
using namespace fastio;
#define multitest() int T; read(T); _rep(tCase, 1, T)
namespace Calculation{
const ll mod = 998244353;
ll ksm(ll p, ll h){ll base = p % mod, res = 1; while(h){if(h & 1ll) res = res * base % mod; base = base * base % mod, h >>= 1ll;} return res;}
void dec(ll &x, ll y){x = ((x - y) % mod + mod) % mod;}
void add(ll &x, ll y){x = (x + y) % mod;}
void mul(ll &x, ll y){x = x * y % mod;}
ll sub(ll x, ll y){return ((x - y) % mod + mod) % mod;}
ll pls(ll x, ll y){return ((x + y) % mod + mod) % mod;}
ll mult(ll x, ll y){return x * y % mod;}
}
using namespace Calculation;
const int N = 5e5 + 5, inf = 0x3f3f3f3f;
int n, q, a[N], b[N];
int main(){
read(n, q);
_rep(i, 1, n) b[i] = inf, a[i] = 5e5;
while(q--){
int opt, l, r; read(opt, l, r);
if(opt == 1){
_rep(i, l, r) a[i]++;
}
if(opt == 2){
_rep(i, l, r) a[i]--, b[i] = b[i] > a[i] ? inf : b[i];
}
if(opt == 3){
_rep(i, l, r) b[i] = min(b[i], a[i]);
}
if(opt == 4){
_rep(i, l, r) a[i] = min(a[i], b[i]);
_rep(i, l, r) b[i] = inf;
}
if(opt == 5) writeln(a[l]);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5740kb
input:
1 9 1 1 1 1 1 1 1 1 1 3 1 1 2 1 1 1 1 1 1 1 1 4 1 1 5 1 1
output:
500004
result:
ok 1 number(s): "500004"
Test #2:
score: 0
Accepted
time: 1ms
memory: 5760kb
input:
3 7 2 1 3 3 1 3 1 1 3 1 1 3 5 1 1 4 1 3 5 1 1
output:
500001 499999
result:
ok 2 number(s): "500001 499999"
Test #3:
score: -100
Time Limit Exceeded
input:
500000 500000 2 132991 371170 5 15281 15281 1 278642 397098 2 152103 176573 2 13797 47775 3 139320 370045 3 79054 432340 3 82556 212775 4 270171 469418 5 148000 148000 3 371255 401414 5 71051 71051 2 358945 473071 2 231663 265401 2 20243 58131 1 247710 313373 5 154549 154549 1 17317 233265 5 37602 3...
output:
500000 499999 500000 499998 499999 500000 500000 499997 500000 499997 499997 499999 499998 500000 499997 500000 499999 500001 499999 499999 499997 499997 499996 499998 500000 500001 500001 499996 499998 499999 499996 499999 500001 500000 500000 500002 500002 499997 500001 499997 499995 499999 500004...