QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#164984 | #6733. Moniphant Sleep | ucup-team1209 | TL | 1ms | 3980kb | C++14 | 908b | 2023-09-05 15:12:09 | 2023-09-05 22:11:24 |
Judging History
answer
#include <bits/stdc++.h>
#define cs const
#define pb push_back
using namespace std;
cs int oo = 1e9 + 7;
cs int N = 5e5 + 5;
int n, q;
int main() {
#ifdef zqj
freopen("1.in","r",stdin);
#endif
cin >> n >> q;
vector <int> a(n + 1, 0), b(n + 1, oo);
for(int z = 0; z < q; z++) {
int op, l, r;
scanf("%d%d%d", &op, &l, &r);
for(int i = l; i <= r; i++) {
if(op == 1) {
++ a[i];
}
if(op == 2) {
-- a[i];
if(a[i] < b[i]) b[i] = oo;
}
if(op == 3) {
if(b[i] == oo) b[i] = a[i];
}
if(op == 4) {
if(b[i] < a[i]) a[i] = b[i];
}
if(op == 5) {
cout << a[i] + 500000 << '\n';
}
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3980kb
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: 0ms
memory: 3980kb
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 499997 499997 500000 499996 499998 499997 499998 499998 499997 499997 499995 499995 499998 500000 500001 499996 499995 499998 499995 499995 499996 499998 499998 499999 499998 499998 499996 500001 499994 499991 499999 499993...