QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#164984#6733. Moniphant Sleepucup-team1209TL 1ms3932kbC++14908b2023-09-05 15:12:092023-09-05 15:12:09

Judging History

你现在查看的是测评时间为 2023-09-05 15:12:09 的历史记录

  • [2023-09-05 22:11:24]
  • 管理员手动重测本题所有提交记录
  • 测评结果:TL
  • 用时:1ms
  • 内存:3980kb
  • [2023-09-05 15:12:09]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3932kb
  • [2023-09-05 15:12:09]
  • 提交

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; 
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3688kb

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: 3932kb

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...

result: