QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#593285 | #8243. Contest Advancement | enze# | AC ✓ | 72ms | 19528kb | C++20 | 1.1kb | 2024-09-27 13:04:39 | 2024-09-27 13:04:40 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define pb push_back
const ld pi = 3.14159265358979323846;
const int mod = (int)1e9 + 7;
const ll INF = 1e18;
template<typename T>
T chmax(T a, T b) {
return a > b ? a : b;
}
template<typename T>
T chmin(T a, T b) {
return a > b ? b : a;
}
const int N = (int)2e5 + 1, M = N * 2;
void solve(){
int n, k, c;
cin >> n >> k >> c;
map<int, int> mp, rec;
vector<vector<int>> a, b;
for(int i = 0; i < n; i++){
int s, t;
cin >> s >> t;
a.pb({s, t});
if(mp[t] >= c || k <= 0) continue;
b.pb({i, s});
rec[i] = 1;
mp[t]++;
k--;
}
for(int i = 0; i < a.size(); i++){
if(rec[i] != 1 && k){
b.pb({i, a[i][0]});
k--;
}
}
sort(b.begin(), b.end());
for(auto e : b) cout << e[1] << endl;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(0);
int t = 1;
// cin >> t;
while(t--){
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3860kb
input:
10 7 3 3 9 1 9 4 9 5 9 9 7 2 7 6 7 7 7 8 5 10 5
output:
3 1 4 9 2 6 8
result:
ok 7 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
10 5 2 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 2
output:
1 2 3 4 10
result:
ok 5 lines
Test #3:
score: 0
Accepted
time: 48ms
memory: 18704kb
input:
100000 99999 1 25404 19 27303 19 71609 19 26420 19 21982 19 36401 19 30572 19 36789 19 17922 19 28079 19 4067 19 55734 19 5014 19 60772 19 93082 19 10601 19 47208 19 23872 19 9828 19 38007 19 63637 19 30916 19 4145 19 35120 19 60564 19 62804 19 30403 19 31698 19 85837 19 16113 19 9037 19 91392 19 86...
output:
25404 27303 71609 26420 21982 36401 30572 36789 17922 28079 4067 55734 5014 60772 93082 10601 47208 23872 9828 38007 63637 30916 4145 35120 60564 62804 30403 31698 85837 16113 9037 91392 86007 57350 13571 15969 6707 79466 63187 83111 49095 58421 17785 76974 42250 60551 16969 77209 23168 83639 6934 8...
result:
ok 99999 lines
Test #4:
score: 0
Accepted
time: 45ms
memory: 16136kb
input:
100000 57 10 28006 71003 68065 26237 47855 44638 8 51776 46042 93419 99756 84321 34404 31342 50465 89482 37239 32208 25866 91241 49331 35757 77902 88884 21518 81545 55940 37330 11249 76416 58064 6653 64760 16870 41739 9421 88929 58622 69721 34298 22136 21487 41032 81727 22997 28220 52539 76341 4523 ...
output:
28006 68065 47855 8 46042 99756 34404 50465 37239 25866 49331 77902 21518 55940 11249 58064 64760 41739 88929 69721 22136 41032 22997 52539 4523 53420 9831 61149 62992 8588 21591 97546 74642 90963 97971 18981 47138 9474 33350 63448 36229 74986 5539 17448 7955 42455 93312 24570 42758 502 37372 61332 ...
result:
ok 57 lines
Test #5:
score: 0
Accepted
time: 48ms
memory: 16912kb
input:
100000 2 4 10894 3258 42586 22884 89346 16513 84877 69185 60508 18753 48199 53812 38805 49206 8880 72680 85822 60467 89331 31188 15153 59447 55426 10892 95647 98247 16969 97602 49173 35578 8238 54477 22150 44490 94 62260 27130 99265 11058 84319 11124 8304 43732 58264 2006 36243 70618 69050 84469 301...
output:
10894 42586
result:
ok 2 lines
Test #6:
score: 0
Accepted
time: 50ms
memory: 16296kb
input:
100000 48 10 47484 12209 21723 72646 88643 32150 86836 61381 20213 69637 9898 62134 1850 40003 32437 47209 82012 41962 65108 95252 62678 65993 44380 58766 32964 95857 38736 50771 24115 44230 67583 40455 33896 3586 26214 85164 7996 80637 65075 5146 23785 45693 64439 52345 5340 99719 26725 4932 73294 ...
output:
47484 21723 88643 86836 20213 9898 1850 32437 82012 65108 62678 44380 32964 38736 24115 67583 33896 26214 7996 65075 23785 64439 5340 26725 73294 30629 79392 293 26522 91792 69187 58292 4519 85320 32014 7410 37882 4051 72703 12996 88795 97793 15922 36616 84452 72436 31002 54600
result:
ok 48 lines
Test #7:
score: 0
Accepted
time: 47ms
memory: 16292kb
input:
100000 66 10 89295 43018 72395 35905 31730 30658 85760 7368 20826 23372 53064 32942 55228 95265 43892 30582 62177 58829 14313 99289 7376 46088 58842 74341 24378 41208 49456 23502 41909 87389 72890 72017 94107 96439 23298 69362 70119 89758 17587 2002 15004 21713 8892 4144 49319 97805 26703 52766 1828...
output:
89295 72395 31730 85760 20826 53064 55228 43892 62177 14313 7376 58842 24378 49456 41909 72890 94107 23298 70119 17587 15004 8892 49319 26703 18282 29493 54065 3703 67759 6139 20429 30851 98243 3162 12357 57482 68575 80864 40331 1288 29337 30927 78971 771 93991 75335 61823 18948 94229 3884 708 34795...
result:
ok 66 lines
Test #8:
score: 0
Accepted
time: 50ms
memory: 16204kb
input:
100000 36 4 8017 65875 96354 70241 21244 66582 54185 71310 55553 75683 46844 16304 58902 93618 29271 63276 43042 91542 13333 78911 45901 89595 9090 12970 90859 38350 92940 69246 44477 4412 17224 19641 74472 48285 86481 28991 24890 21420 65836 82680 11115 48200 46298 33266 93651 73611 37577 39142 375...
output:
8017 96354 21244 54185 55553 46844 58902 29271 43042 13333 45901 9090 90859 92940 44477 17224 74472 86481 24890 65836 11115 46298 93651 37577 37522 5689 6481 89533 82671 7692 57121 44289 35762 39571 8161 93471
result:
ok 36 lines
Test #9:
score: 0
Accepted
time: 52ms
memory: 15220kb
input:
80851 28262 54171 63871 7206 44048 13391 6642 13955 34465 35141 37070 9097 61660 15154 5896 77909 46979 26462 13823 9338 75298 78593 40109 6086 48692 7746 33653 32724 57356 48052 59386 9964 44837 42777 16675 4071 46919 66364 31506 9300 56408 5935 16441 57902 30573 16154 12220 21224 6187 80444 28968 ...
output:
63871 44048 6642 34465 37070 61660 5896 46979 13823 75298 40109 48692 33653 57356 59386 44837 16675 46919 31506 56408 16441 30573 12220 6187 28968 18179 75405 42934 33777 7619 34745 43408 76920 73506 49212 48223 37481 29219 5089 76423 47831 19394 8430 5556 16920 76006 17790 77999 23339 22810 38357 6...
result:
ok 28262 lines
Test #10:
score: 0
Accepted
time: 43ms
memory: 14832kb
input:
63496 60905 60495 25704 17782 44432 4692 28370 50126 20601 27512 31154 15209 14501 17298 1688 53587 15981 18805 23306 21449 9629 46906 3703 8022 59432 22742 9231 25244 28411 50736 62515 56764 40328 50426 5892 31896 59290 48588 35318 26241 23694 29488 25964 35216 47701 44345 31260 52855 48732 23388 3...
output:
25704 44432 28370 20601 31154 14501 1688 15981 23306 9629 3703 59432 9231 28411 62515 40328 5892 59290 35318 23694 25964 47701 31260 48732 30159 24883 32378 11778 9468 4527 5477 19663 38806 58754 20053 22554 1107 3203 48270 2797 47409 7464 62297 27705 41999 46527 12880 12875 62419 624 29318 29261 27...
result:
ok 60905 lines
Test #11:
score: 0
Accepted
time: 3ms
memory: 4256kb
input:
3842 3631 2021 1810 3686 2083 2946 282 2528 2822 905 2494 1638 2051 543 885 1015 245 1019 835 1468 454 3620 968 1051 290 1600 1366 171 91 291 295 1325 3597 1774 1199 3030 711 359 3204 2399 2026 2734 951 969 2075 3005 645 1873 2836 2458 3409 2208 811 2838 1421 689 2459 3056 1922 1174 2306 2764 1092 3...
output:
1810 2083 282 2822 2494 2051 885 245 835 454 968 290 1366 91 295 3597 1199 711 3204 2026 951 2075 645 2836 3409 811 1421 2459 1922 2306 1092 569 1581 2072 32 1118 1646 1053 1817 597 3306 982 3502 631 2895 2927 1381 2584 637 2115 730 2718 1808 1878 1123 3694 3106 2226 903 1019 3305 2138 3685 2524 194...
result:
ok 3631 lines
Test #12:
score: 0
Accepted
time: 41ms
memory: 12596kb
input:
56807 36369 13182 51412 44317 4993 56777 44557 28398 19319 7935 45786 15316 23194 16978 20912 42404 54798 40988 9145 32462 4555 14196 40669 26080 34065 13213 863 50406 56120 12869 11915 33415 49952 1651 53311 1729 42831 32246 3407 21382 50424 16574 24691 5882 9634 25665 6576 33715 24825 48244 627 13...
output:
51412 4993 44557 19319 45786 23194 20912 54798 9145 4555 40669 34065 863 56120 11915 49952 53311 42831 3407 50424 24691 9634 6576 24825 627 7872 35953 19974 8235 41745 26762 26084 35315 33666 10865 10773 45136 11643 45280 50348 21123 295 28504 21760 1855 12007 56711 29499 22925 9872 8959 14238 6997 ...
result:
ok 36369 lines
Test #13:
score: 0
Accepted
time: 12ms
memory: 9324kb
input:
42640 7331 9414 19701 16454 25359 41261 21585 34857 23771 581 29578 18147 20947 38802 3995 2335 25052 29214 40728 41343 7205 30425 2503 14319 13969 18695 12945 9810 17926 37237 18576 28587 26935 2185 20714 17434 2760 28473 3708 2712 35260 29289 36357 8787 40562 25304 18378 34966 26369 30424 4753 336...
output:
19701 25359 21585 23771 29578 20947 3995 25052 40728 7205 2503 13969 12945 17926 18576 26935 20714 2760 3708 35260 36357 40562 18378 26369 4753 41106 33558 13818 2347 26971 20012 21851 10908 40644 23840 31075 21305 33465 6712 41481 31619 26582 33553 24623 16075 30125 19182 16306 26933 3998 2870 3348...
result:
ok 7331 lines
Test #14:
score: 0
Accepted
time: 40ms
memory: 14876kb
input:
100000 6782 1 23109 806 79221 20340 97331 7473 37881 4942 802 17398 17203 16373 39935 19848 25451 14339 18827 2995 63719 2934 52947 11402 39351 9881 71309 16589 22381 6090 4722 14115 99529 9045 97387 1498 995 16468 78238 2871 18210 15430 6278 20880 10595 15360 66355 20715 69279 16751 34328 24990 417...
output:
23109 79221 97331 37881 802 17203 39935 25451 18827 63719 52947 39351 71309 22381 4722 99529 97387 995 78238 18210 6278 10595 66355 69279 34328 41705 37445 23438 21077 53399 75774 69761 32964 41332 3659 17239 1143 5616 84192 15302 5126 44614 16394 83003 64464 88761 2827 29683 16545 11081 10774 23788...
result:
ok 6782 lines
Test #15:
score: 0
Accepted
time: 42ms
memory: 14892kb
input:
100000 9248 1 23618 3939 30857 13736 68532 3791 5037 16506 49870 9296 32709 827 41758 19349 18764 4940 57792 1848 15253 5025 5542 22491 12191 2715 22263 9579 92607 23190 50792 20071 51717 9526 81102 6285 6492 17544 3536 4788 7705 4264 5520 3582 37676 14471 73469 1129 32622 19687 63360 20165 57031 15...
output:
23618 30857 68532 5037 49870 32709 41758 18764 57792 15253 5542 12191 22263 92607 50792 51717 81102 6492 3536 7705 5520 37676 73469 32622 63360 57031 17 52386 61240 81619 28094 34928 36170 14204 42050 89591 54962 37763 831 33968 39361 82484 21234 45811 20652 64549 62123 89865 36533 61264 35389 19732...
result:
ok 9248 lines
Test #16:
score: 0
Accepted
time: 72ms
memory: 19528kb
input:
100000 82650 1 72710 7088 21454 11021 40347 22323 79787 13691 38373 9488 72250 20216 75606 9389 96497 7922 15843 20389 71504 15267 18732 12557 56518 24859 24815 19004 67042 2487 24917 14972 25587 18223 7570 9365 59441 11616 27326 12265 62312 9801 69943 4168 73040 17821 79757 23147 51325 19571 80369 ...
output:
72710 21454 40347 79787 38373 72250 75606 96497 15843 71504 18732 56518 24815 67042 24917 25587 7570 59441 27326 62312 69943 73040 79757 51325 80369 38820 36439 76250 60071 58757 40251 62733 49435 48323 72748 67770 39741 24574 51650 13193 57855 52001 92677 91478 70203 27232 9959 1848 17304 67245 420...
result:
ok 82650 lines
Test #17:
score: 0
Accepted
time: 60ms
memory: 16976kb
input:
100000 44409 1 5022 16269 6473 11318 84724 22912 80703 4828 49328 10720 87865 16353 998 20837 5158 22867 10006 14957 35316 24813 14880 17426 48020 10073 4723 6482 727 17469 91341 24999 72873 19886 9409 64 19954 1528 12454 7822 13434 16922 78864 20717 17019 12441 27941 13335 64087 19560 89516 22112 7...
output:
5022 6473 84724 80703 49328 87865 998 5158 10006 35316 14880 48020 4723 727 91341 72873 9409 19954 12454 13434 78864 17019 27941 64087 89516 73418 83239 42370 1057 41740 33873 49056 72969 57651 15102 29867 79604 13385 1186 91401 82848 30281 22247 14623 13391 30613 47905 34062 44266 96029 51880 63255...
result:
ok 44409 lines
Test #18:
score: 0
Accepted
time: 44ms
memory: 17332kb
input:
100000 50247 1 20510 2519 83734 16935 44714 21068 34846 15059 30877 5874 7018 22835 72461 12253 80929 6083 86640 20067 90618 264 58013 22098 6101 7715 98804 3074 46421 8332 4559 2574 92630 13046 97015 6529 30551 18108 62005 19716 90021 23175 28864 14456 94098 981 5173 13452 45654 9044 2415 23517 360...
output:
20510 83734 44714 34846 30877 7018 72461 80929 86640 90618 58013 6101 98804 46421 4559 92630 97015 30551 62005 90021 28864 94098 5173 45654 2415 36026 17953 32081 10693 14505 15874 13455 8305 62798 11130 49446 94771 35962 34797 16740 90374 27397 57267 42913 32716 84293 45735 85616 30760 77045 85133 ...
result:
ok 50247 lines