QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#791082 | #6604. Kobolds and Catacombs | Hans | WA | 74ms | 11276kb | C++23 | 632b | 2024-11-28 16:47:09 | 2024-11-28 16:47:09 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
struct m {
int min;
int max;
};
int main() {
ios::sync_with_stdio(false);
int n; cin >> n;
stack<m> s;
int tmp;
while (n--) {
cin >> tmp;
if (s.size() == 0 || tmp > s.top().max)
s.push({.min=tmp, .max=tmp});
else if (tmp == s.top().max && tmp == s.top().min) {
s.push({.min=tmp, .max=tmp});
} else if (tmp < s.top().min) {
struct m m = { .min=tmp, .max=s.top().max};
s.pop();
while (s.size() && tmp < s.top().max) s.pop();
s.push(m);
}
}
cout << s.size() << endl;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3540kb
input:
5 1 3 2 7 4
output:
3
result:
ok 1 number(s): "3"
Test #2:
score: 0
Accepted
time: 65ms
memory: 3612kb
input:
1000000 524227301 431992275 758916082 293029389 719487809 413407585 7533705 414925441 87316769 639877621 980912701 739058961 277730843 958292661 778325685 500280161 782766985 339709027 1968001 842653531 847517701 989893001 97622801 728458741 612188545 787566057 981715521 281901909 804267925 89113887...
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 53ms
memory: 3804kb
input:
1000000 917949585 857260961 756665311 378355301 764449441 412507811 172034129 259899788 32062001 770226301 952621053 541484449 569936821 627592441 215749889 859777895 354928623 873704001 816399789 991063481 915131641 712367896 390917421 345695004 999782016 716109223 361816825 689562663 101790565 284...
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 41ms
memory: 11276kb
input:
1000000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
1000000
result:
ok 1 number(s): "1000000"
Test #5:
score: 0
Accepted
time: 74ms
memory: 11224kb
input:
1000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 100000...
output:
1000000
result:
ok 1 number(s): "1000000"
Test #6:
score: 0
Accepted
time: 46ms
memory: 11148kb
input:
1000000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...
output:
1000000
result:
ok 1 number(s): "1000000"
Test #7:
score: 0
Accepted
time: 54ms
memory: 3840kb
input:
1000000 1000000 999999 999998 999997 999996 999995 999994 999993 999992 999991 999990 999989 999988 999987 999986 999985 999984 999983 999982 999981 999980 999979 999978 999977 999976 999975 999974 999973 999972 999971 999970 999969 999968 999967 999966 999965 999964 999963 999962 999961 999960 9999...
output:
1
result:
ok 1 number(s): "1"
Test #8:
score: 0
Accepted
time: 50ms
memory: 3836kb
input:
1000000 644593 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 644101 26 27 28 29 30 31 32 643568 34 35 330711 339005 38 39 40 578571 42 43 44 45 46 47 48 49 50 683111 52 53 54 936601 56 26971 58 59 60 909777 62 63 64 479605 66 67 68 69 216503 71 72 133286 74 75 76 77 78 950161 80 81 82...
output:
5
result:
ok 1 number(s): "5"
Test #9:
score: 0
Accepted
time: 53ms
memory: 3552kb
input:
1000000 925960 484918 999998 999997 999996 999995 999994 999993 999992 999991 396232 999989 999988 999987 999986 909136 999984 999983 999982 999981 546797 999979 999978 999977 370720 999975 999974 999973 889900 999971 999970 999969 428403 999967 999966 999965 941125 999963 999962 999961 999960 99995...
output:
1
result:
ok 1 number(s): "1"
Test #10:
score: 0
Accepted
time: 0ms
memory: 3516kb
input:
1 1
output:
1
result:
ok 1 number(s): "1"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
1 1000000000
output:
1
result:
ok 1 number(s): "1"
Test #12:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
2 1 2
output:
2
result:
ok 1 number(s): "2"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
2 999999999 1
output:
1
result:
ok 1 number(s): "1"
Test #14:
score: 0
Accepted
time: 64ms
memory: 3832kb
input:
1000000 586342723 439528582 534325601 527397441 69111047 708525733 964567125 797408989 657663242 361074481 351855001 683394036 768478938 866430981 391488941 139668993 315700283 301683796 950938618 652811201 895030718 762246051 758513505 431480309 505858381 868633425 709348153 39897089 874006729 1198...
output:
1
result:
ok 1 number(s): "1"
Test #15:
score: 0
Accepted
time: 65ms
memory: 3584kb
input:
1000000 954794397 659831876 690237901 61500881 278431281 156748253 446041221 842695161 546785671 773749926 485956147 609494627 400435921 8377321 766721779 136618697 931232625 872057921 658877059 522113233 796888245 82127761 841077901 652095691 764639540 484453926 33179521 433549441 760785241 3486318...
output:
1
result:
ok 1 number(s): "1"
Test #16:
score: 0
Accepted
time: 64ms
memory: 3544kb
input:
1000000 128840331 879801121 670528493 901520277 287501561 470233351 378643431 513453281 682933401 790677901 165011489 984840511 127177501 429591681 278342801 752147841 692314989 832989249 467306522 456552948 423884289 191857613 158974681 426788513 149616705 324894881 957251929 843413581 77455801 979...
output:
1
result:
ok 1 number(s): "1"
Test #17:
score: 0
Accepted
time: 60ms
memory: 3484kb
input:
1000000 161013121 664403189 614216489 698442181 219647457 436165251 998498409 287752251 300275311 329438101 56648611 639847201 79783786 5691119 696920001 52923297 311784066 955714611 683832021 689830541 968313713 402592241 253942497 83948056 913972223 937838081 473079781 824166351 597287105 96825832...
output:
1
result:
ok 1 number(s): "1"
Test #18:
score: -100
Wrong Answer
time: 0ms
memory: 3540kb
input:
8 1 3 2 3 6 2 5 6
output:
2
result:
wrong answer 1st numbers differ - expected: '3', found: '2'