QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#189846 | #6114. Agriculture | KKT89 | AC ✓ | 40ms | 6036kb | C++17 | 1.6kb | 2023-09-28 00:39:14 | 2023-09-28 00:39:14 |
Judging History
answer
#pragma GCC optimize("Ofast")
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
#include <deque>
#include <stack>
#include <sstream>
#include <utility>
#include <cstring>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <array>
#include <bitset>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
return (ull)rng() % B;
}
inline ll time() {
return static_cast<long double>(chrono::duration_cast<chrono::nanoseconds>(chrono::steady_clock::now().time_since_epoch()).count()) * 1e-9;
}
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n; cin >> n;
vector<int> s(n),t(n);
vector<pair<int,int>> v;
for(int i=0;i<n;i++){
cin >> s[i] >> t[i];
v.push_back({s[i],(i+1)});
v.push_back({t[i]+1,-(i+1)});
}
sort(v.begin(), v.end());
int q; cin >> q;
int idx = 0;
int res = 0;
set<int> st;
while(q--){
int h; cin >> h;
while(idx < v.size() and v[idx].first <= h){
int x = v[idx].second;
if(x > 0){
st.insert(x);
}
else{
if(st.find(-x) != st.end()){
st.erase(-x);
}
}
idx++;
}
res += st.size(); st.clear();
}
cout << res << endl;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3516kb
input:
4 1 2 3 3 2 4 7 9 2 3 9
output:
3
result:
ok 1 number(s): "3"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3412kb
input:
4 1 5 5 10 3 8 5 5 1 5
output:
4
result:
ok 1 number(s): "4"
Test #3:
score: 0
Accepted
time: 1ms
memory: 3508kb
input:
43 12992 34983 33499 90420 53100 94360 46389 53210 74360 89585 21701 85719 83860 92904 5223 16975 32022 91153 12231 18884 67629 73202 66272 82452 50118 76572 80439 90048 6601 33437 56579 85417 45713 57231 91789 92974 27492 54276 23726 52109 47635 87277 5198 91101 65589 99076 27926 31672 48249 80293 ...
output:
41
result:
ok 1 number(s): "41"
Test #4:
score: 0
Accepted
time: 1ms
memory: 3480kb
input:
98 16723 66090 52915 80020 14292 49030 81995 91658 80207 86800 56497 77256 13631 69615 16243 60887 42606 82531 5326 51906 67388 84078 9469 89976 13520 59465 86503 94801 1037 43482 55611 93980 4087 12677 13211 39334 66707 80378 62318 96408 66454 70983 27125 28591 3679 16055 5160 38580 12702 28696 826...
output:
97
result:
ok 1 number(s): "97"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
50 15455 73319 6401 53470 19660 64885 6065 45929 9485 71396 44661 64985 38660 71065 4247 59528 44458 73996 11636 22648 38736 46065 2857 23756 16452 81381 15890 32627 49673 96709 7928 45794 12482 39460 4728 97605 55521 83576 14496 21264 20785 99826 6580 92252 37686 49403 54813 71692 33574 59447 37037...
output:
48
result:
ok 1 number(s): "48"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3464kb
input:
1 37052 51200 64 350 1420 2754 5842 7349 12323 13033 17384 17860 18364 19759 21414 21470 22245 22895 22934 23752 24641 24763 25133 26683 30233 30822 33832 35909 38580 39180 41776 44514 46221 47985 48361 49795 51262 51458 52173 52250 52484 56605 61742 62080 62851 62861 64574 66004 66184 66246 68146 6...
output:
1
result:
ok 1 number(s): "1"
Test #7:
score: 0
Accepted
time: 1ms
memory: 3508kb
input:
7 10141 89365 28442 39991 3391 65539 11021 51210 43537 84432 85517 91438 46057 56850 70 361 534 2755 6068 17235 17282 20497 21335 23741 23977 26817 27613 29171 29963 31212 32035 32181 33622 33733 35731 40522 40683 42829 43794 44586 46367 48112 49882 51069 51137 54652 55165 57006 57183 62242 65326 65...
output:
7
result:
ok 1 number(s): "7"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3448kb
input:
4 37262 98331 10275 32812 56987 59250 57947 83807 18 1264 9657 13688 19560 19857 25272 30244 54832 55489 64154 67601 73835 75980 76654 76921 90560 94785 98474
output:
3
result:
ok 1 number(s): "3"
Test #9:
score: 0
Accepted
time: 1ms
memory: 3512kb
input:
30 91853 98263 33132 78079 37917 82873 23619 48682 12815 55871 2668 73323 42636 90798 5006 32874 68080 99825 34054 36093 8600 12042 5834 79473 15016 33205 13337 57364 13987 72680 40161 71971 75003 97414 17986 87907 20955 81798 40333 81101 55435 97080 58132 61561 3741 31141 64496 72116 37684 50714 57...
output:
20
result:
ok 1 number(s): "20"
Test #10:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
24 46291 56516 55000 55560 54906 75270 28308 85890 83446 96549 14248 65149 34203 64004 17169 98003 82783 97755 8961 9486 4050 88465 32392 39435 43514 57928 60496 97852 29048 78825 31289 97278 84215 91151 30838 96079 3599 13862 28618 66867 15080 83703 74040 97444 19493 41588 7729 8365 62 778 1229 266...
output:
22
result:
ok 1 number(s): "22"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3512kb
input:
48 8536 97532 21880 60657 40483 53866 47886 86155 14239 63390 13842 56955 35442 58860 27482 32202 33430 90754 18827 72909 13717 67302 18236 40975 81536 86391 54803 68602 50111 65285 3662 28419 18794 94308 76871 77345 30605 64316 20093 53212 6323 20201 8967 44878 37414 41186 62288 93215 48703 67580 4...
output:
45
result:
ok 1 number(s): "45"
Test #12:
score: 0
Accepted
time: 0ms
memory: 3448kb
input:
64 32247 92046 58463 88351 113 66746 52286 82289 32971 45570 32529 57238 71850 78974 440 13292 33760 70079 36927 48270 34483 36075 58405 75480 12405 54403 51760 82724 9259 24248 14572 83303 1093 73396 26677 32574 33832 88098 85646 97888 40698 77107 70476 76547 93739 94988 76614 86148 48002 48785 489...
output:
60
result:
ok 1 number(s): "60"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
4636 260381159 384900176 398984564 461380856 483175603 968115643 356964260 485606975 437824587 744745331 263968915 864728124 462323078 535885205 42474814 827024266 150898730 419758064 623464531 869102832 339327391 999387795 91869242 765982422 600583424 928958735 107301691 487749975 531572272 5538270...
output:
4635
result:
ok 1 number(s): "4635"
Test #14:
score: 0
Accepted
time: 22ms
memory: 4592kb
input:
47601 52444471 554510657 303331172 621676285 331956846 891394887 415648810 676861856 211455721 678017129 272856045 924397065 327176781 614759496 702793680 787038046 210186837 313626812 505394542 592783047 496739735 884637761 409400077 933144529 118814952 459697889 68194993 710887304 8148148 95005177...
output:
47601
result:
ok 1 number(s): "47601"
Test #15:
score: 0
Accepted
time: 36ms
memory: 5932kb
input:
86937 81034020 406680554 237655599 513232517 124367522 725014137 48071413 427946878 263092973 469536095 113746719 877600570 531491760 770942330 244420232 894982938 124812950 139412076 57485494 362846770 36142535 997064261 594782303 989575424 596482528 878487715 472031648 729303245 321493175 45466547...
output:
86936
result:
ok 1 number(s): "86936"
Test #16:
score: 0
Accepted
time: 18ms
memory: 5824kb
input:
65833 772963765 872377906 828088663 952865138 158389768 964714889 738283894 855456111 169987028 404964453 426946286 628746078 415738035 776876692 371859297 884595573 84656534 236233629 500655601 550160175 514793688 781849421 742019811 835923300 745450900 875730096 687528377 732867635 157816404 24189...
output:
65828
result:
ok 1 number(s): "65828"
Test #17:
score: 0
Accepted
time: 10ms
memory: 4440kb
input:
36120 132298987 925419395 283250251 781973728 376920300 511372980 5459345 25047793 87925077 907625021 408197692 629996241 478844962 787570734 602243590 841916023 358131515 512637829 245218657 821694045 59628424 621135801 130396431 980390534 477129558 923475317 21553839 195850923 409183046 863648041 ...
output:
36112
result:
ok 1 number(s): "36112"
Test #18:
score: 0
Accepted
time: 11ms
memory: 4572kb
input:
43940 670624193 763675992 5652840 782916668 5500241 591658944 586677439 642362175 851987878 953956494 183775454 339602016 731802499 878744856 144353843 885294741 261420108 712621274 533940646 958830488 291484678 831819646 256384150 614552000 381395789 581391771 743247536 980174650 258235563 28926817...
output:
43936
result:
ok 1 number(s): "43936"
Test #19:
score: 0
Accepted
time: 7ms
memory: 3792kb
input:
12943 525942146 639332955 529283916 831601748 310118974 365479971 75466076 417024599 395263434 709770641 284486078 669872311 66613466 506071889 789135732 827548305 385395614 489394527 622240382 939829481 625830681 915915116 355768178 917279220 8528137 495081219 125976204 558719033 288831709 41822717...
output:
12942
result:
ok 1 number(s): "12942"
Test #20:
score: 0
Accepted
time: 33ms
memory: 5932kb
input:
89160 339419090 436157110 276422744 469186332 256078969 323211914 294218245 742237554 331391621 422178397 235498484 860772811 344604216 801213602 28936424 277656997 754293043 790658016 494316845 791186211 144217465 412563840 40216759 360944508 336078561 730478470 218275863 519213078 83825026 2684259...
output:
89154
result:
ok 1 number(s): "89154"
Test #21:
score: 0
Accepted
time: 26ms
memory: 5800kb
input:
69103 768710740 800533135 315913311 668326078 358171515 372540170 564056672 819094242 671661725 765505771 222993679 754041358 584410665 934852100 646062205 936708624 356576541 988539629 67743716 856706808 433275274 540200799 175319109 551442090 360233479 541236360 305038412 698134770 201977163 59297...
output:
69094
result:
ok 1 number(s): "69094"
Test #22:
score: 0
Accepted
time: 22ms
memory: 5944kb
input:
82439 693610125 738461583 182823277 350466512 253323846 592705532 813296169 965550836 682920063 805043065 586199101 710344705 529026463 718482449 113378436 579327654 700196713 772713079 689688542 885304051 282619557 359643733 396900108 631612551 176274003 756134163 339796621 429775380 516710669 6034...
output:
82437
result:
ok 1 number(s): "82437"
Test #23:
score: 0
Accepted
time: 12ms
memory: 4012kb
input:
25069 598574183 882946656 7207396 7240253 155225402 155234564 263531001 328352259 416136676 975436132 872459730 872515821 882325152 882352502 122260223 685162117 376277213 376369366 117634615 225836219 322696872 837449042 936928020 936991237 103635952 103654493 340244670 348425171 708933744 70898221...
output:
22648
result:
ok 1 number(s): "22648"
Test #24:
score: 0
Accepted
time: 25ms
memory: 5916kb
input:
87449 260556573 260636940 146376285 566983799 375446868 375501982 519699000 519716926 923204740 923258128 225844367 688860418 263354496 263445751 409333858 409367981 70189870 684136550 548626439 862553460 304750744 304755137 321782083 801327593 39261575 138960346 218738206 218793796 546515985 607998...
output:
78804
result:
ok 1 number(s): "78804"
Test #25:
score: 0
Accepted
time: 22ms
memory: 4512kb
input:
45697 49107833 268100421 294985183 617975900 856061289 856071170 595448873 996535925 358031128 384804134 474123462 474147555 761205984 761211122 515455484 515536421 638717429 638814846 462964539 463020960 591310500 762848805 317886115 795590830 710297698 710325750 861438760 861519948 812793741 81283...
output:
43371
result:
ok 1 number(s): "43371"
Test #26:
score: 0
Accepted
time: 4ms
memory: 3708kb
input:
8209 450761163 450802517 541604040 642656701 531840715 579711467 124940903 919690223 371009660 415779830 278188479 912055343 566575902 566646683 650434203 932536220 847218832 847317844 122259579 872398656 26190032 843425842 244108727 729135501 189288832 189349544 486426921 667608501 212813889 841131...
output:
4977
result:
ok 1 number(s): "4977"
Test #27:
score: 0
Accepted
time: 23ms
memory: 4752kb
input:
63611 469449494 708405008 848055730 848143619 215787814 223469248 666150498 666239815 113658106 847880485 40491461 920443121 509726039 648270545 197762363 819099415 942379690 942404320 27866089 27953595 838429974 838430946 388209640 966035430 843670948 843742666 52030342 52046644 819773596 819781882...
output:
37553
result:
ok 1 number(s): "37553"
Test #28:
score: 0
Accepted
time: 40ms
memory: 6036kb
input:
99538 170860129 170877352 497353449 923976567 46580580 339693013 300538048 300631249 380919335 380972832 543254139 543314731 551911841 551963074 277908160 322919486 616258372 616291350 295502436 295540814 426855706 972672354 181912639 181948528 642611122 642626363 998451470 998468879 725280721 72531...
output:
51755
result:
ok 1 number(s): "51755"
Test #29:
score: 0
Accepted
time: 23ms
memory: 4644kb
input:
56021 200716097 200752903 759976534 891834673 672665006 672715258 732772922 732836973 555858836 662988669 31144653 438719839 585575955 585675783 351700847 921461365 143585077 879486005 269287052 572923320 194592872 326161579 754468302 986924110 726887837 726899765 381618572 631322138 120457090 98432...
output:
53075
result:
ok 1 number(s): "53075"
Test #30:
score: 0
Accepted
time: 21ms
memory: 4680kb
input:
53581 254519040 254593557 86052553 86093675 47043228 522212146 118325270 118377879 225957324 822154117 540404135 540474554 114125477 305681507 116601817 397864021 452980024 453030496 405927612 405957576 427044251 427108616 207488232 725371259 345706082 957187580 546651742 546720225 83932165 83992425...
output:
36419
result:
ok 1 number(s): "36419"
Test #31:
score: 0
Accepted
time: 40ms
memory: 5964kb
input:
94776 155414421 155511794 826813639 959181858 636515419 636564523 442058251 442119046 844237627 844291786 823633855 935624121 103083229 103096825 201431676 440203971 770553011 770569866 491790265 491834574 505175505 536458525 234167521 234241478 185570355 227858475 43781116 43796315 213318803 213378...
output:
88595
result:
ok 1 number(s): "88595"
Test #32:
score: 0
Accepted
time: 7ms
memory: 3752kb
input:
6844 273637775 273713149 609029836 893964763 571005770 571076459 867405757 867459178 158905373 772558207 826086676 826179497 111272998 481291857 699839661 699863752 278717420 418799009 823577508 966197161 71522582 71556867 101249260 771183910 744270225 744272807 97431954 97495302 272554312 272619195...
output:
6200
result:
ok 1 number(s): "6200"