QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#40318 | #880. Film Critics | Wu_Ren | WA | 104ms | 13344kb | C++14 | 717b | 2022-07-20 11:10:29 | 2022-07-20 11:10:30 |
Judging History
answer
#include <bits/stdc++.h>
#define No() puts("impossible"),exit(0)
#define fi first
#define se second
using namespace std;
set<pair<int,int> >s;
int n,m,k,ans[200010];
pair<int,int>a[200010];
int main(){
// ios::sync_with_stdio(0);
cin>>n>>m>>k;
if(k%m) No();
for(int i=1,w;i<=n;i++){
cin>>a[i].fi,a[i].se=i;
}
sort(a+1,a+n+1);
for(int i=1;i<=n-k/m;i++) s.insert(a[i]);
int nw=0;
for(int i=1,j=n-k/m+1;i<=n;i++){
if(j<=n&&nw<=a[j].fi*(i-1)){
ans[i]=a[j++].se,nw+=m;
continue;
}
if(i==1) No();
auto it=s.lower_bound({(nw+i-2)/(i-1),1000000000});
if(it==s.begin()) No();
--it;
ans[i]=it->se,s.erase(it);
}
for(int i=1;i<=n;i++) cout<<ans[i]<<" ";cout<<"\n";
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5664kb
input:
5 10 30 10 5 3 1 3
output:
5 3 2 1 4
result:
ok OK!
Test #2:
score: 0
Accepted
time: 2ms
memory: 5604kb
input:
5 5 20 5 3 3 3 3
output:
impossible
result:
ok OK!
Test #3:
score: 0
Accepted
time: 2ms
memory: 3656kb
input:
5 10 20 6 1 9 3 2
output:
1 4 3 5 2
result:
ok OK!
Test #4:
score: 0
Accepted
time: 2ms
memory: 3592kb
input:
5 10 20 5 3 10 7 10
output:
3 5 4 1 2
result:
ok OK!
Test #5:
score: 0
Accepted
time: 2ms
memory: 3564kb
input:
5 10 30 1 0 1 8 5
output:
3 1 5 4 2
result:
ok OK!
Test #6:
score: 0
Accepted
time: 2ms
memory: 3568kb
input:
5 10 30 2 0 5 4 2
output:
5 1 2 4 3
result:
ok OK!
Test #7:
score: 0
Accepted
time: 3ms
memory: 5704kb
input:
100 10 100 10 10 4 8 10 0 7 8 3 3 2 3 1 8 1 5 0 0 3 3 7 10 10 5 1 9 4 3 4 5 6 5 2 7 5 6 5 0 4 9 7 0 6 5 8 0 9 3 2 3 0 4 4 10 9 0 1 0 2 3 1 5 3 8 0 1 10 7 2 10 3 9 3 10 7 7 0 7 1 6 6 3 7 7 6 9 10 8 3 1 7 9 10 9 8 5 5 0 8 4
output:
impossible
result:
ok OK!
Test #8:
score: 0
Accepted
time: 2ms
memory: 3568kb
input:
100 10 500 6 3 9 7 6 9 0 9 2 8 1 3 1 6 1 0 5 9 5 0 8 6 6 6 4 5 9 10 9 1 4 6 4 7 0 2 10 6 8 3 10 10 10 6 4 2 9 1 3 7 6 8 2 9 8 7 8 2 4 0 0 4 0 1 8 3 9 3 3 9 5 5 5 10 5 0 2 1 7 3 1 1 7 3 10 8 6 1 4 2 9 2 2 7 7 9 8 9 3 10
output:
75 73 1 72 5 14 71 22 26 23 24 19 32 17 38 44 89 51 62 87 4 34 50 56 79 83 94 59 95 10 21 39 52 55 57 65 86 97 3 6 8 18 27 29 47 54 67 70 91 96 98 28 37 41 42 43 74 85 100 45 33 31 25 99 84 80 69 68 66 49 40 12 2 93 92 90 77 58 53 46 36 9 88 82 81 78 64 48 30 15 13 11 76 63 61 60 35 20 16 7
result:
ok OK!
Test #9:
score: 0
Accepted
time: 2ms
memory: 3660kb
input:
100 10 700 4 1 4 5 1 0 5 4 10 1 1 7 3 5 9 7 10 8 0 5 3 5 10 3 6 6 3 7 8 9 2 5 7 7 7 2 2 5 5 1 8 5 9 9 7 9 0 8 7 4 0 1 7 7 0 5 4 2 10 5 6 0 6 4 7 7 3 0 8 8 10 0 3 6 9 7 9 9 1 5 5 1 3 7 6 2 4 1 6 5 10 7 1 9 2 10 8 10 6 2
output:
73 67 27 24 83 1 21 13 3 100 8 95 86 50 58 57 37 36 64 31 87 4 7 14 20 93 22 88 32 82 38 79 39 52 42 40 56 11 60 10 80 5 81 2 90 25 26 61 63 74 85 89 99 12 16 28 33 34 35 45 49 53 54 65 66 76 84 92 18 29 41 48 69 70 97 15 30 43 44 46 75 77 78 94 9 17 23 59 71 91 96 98 72 68 62 55 51 47 19 6
result:
ok OK!
Test #10:
score: 0
Accepted
time: 2ms
memory: 3564kb
input:
1 1234 1234 1013
output:
1
result:
ok OK!
Test #11:
score: 0
Accepted
time: 2ms
memory: 3592kb
input:
1 1234 1233 624
output:
impossible
result:
ok OK!
Test #12:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
1 1234 0 687
output:
impossible
result:
ok OK!
Test #13:
score: 0
Accepted
time: 104ms
memory: 10744kb
input:
200000 10000 1000000000 8921 3623 7011 8278 8086 2783 4457 5902 7464 5876 1579 2253 8966 3408 987 5502 9659 4223 5299 3681 1608 9803 684 4099 953 6217 3496 9612 5796 4970 266 7260 2634 4780 6478 9399 8243 789 9559 6407 682 1609 5280 842 5489 4685 4688 4649 3167 2157 6727 3552 7107 1001 3453 2361 190...
output:
16298 15207 13632 22213 11385 23692 193753 24819 191755 57806 184092 69424 161762 72292 140037 74393 117903 82928 117878 85248 93464 86911 84731 87671 41298 89308 38488 91095 38309 105638 10562 136135 185000 151467 182856 173806 182726 182423 171195 185150 164741 190018 155318 192753 149251 194589 1...
result:
ok OK!
Test #14:
score: 0
Accepted
time: 97ms
memory: 13344kb
input:
200000 10000 400000000 1375 4634 6196 7880 3916 5282 5886 5029 9624 1822 6029 3390 9761 3178 5301 2057 3609 9748 8052 2455 3306 9857 4539 4130 3354 9277 5528 9435 4129 6993 2749 1356 3565 4986 6120 7997 3711 744 6146 8674 2764 3155 9681 1362 1644 6703 9630 3811 300 5236 8750 1296 2846 8167 6441 969 ...
output:
impossible
result:
ok OK!
Test #15:
score: 0
Accepted
time: 87ms
memory: 9748kb
input:
200000 10000 1200000000 5640 8949 4055 7828 7186 2174 7896 2683 6277 9589 4157 9738 3996 9909 9230 9023 6224 7346 2136 8913 7823 4340 8546 7659 5209 1175 5744 3827 6604 473 5896 5576 9207 3807 4000 7556 824 9571 8904 8568 9402 5280 5041 7686 5803 4248 5886 7239 6252 7283 5910 9883 8517 6464 2339 502...
output:
80221 74163 67694 84272 60691 91205 47171 45610 109102 42903 111303 37098 33976 114075 24233 118771 21915 10727 128500 8141 129676 193881 187343 134648 173234 158892 171466 171081 175479 169855 179948 167992 165243 2951 164144 3105 163747 145876 4330 145146 4646 128259 125727 13460 123629 29738 1201...
result:
ok OK!
Test #16:
score: 0
Accepted
time: 71ms
memory: 8252kb
input:
200000 10000 1503000000 4883 3705 3823 2099 5338 2416 6425 3409 1205 2419 8934 890 8719 9768 1352 1081 3399 8595 1222 2645 2846 11 9446 9981 7398 9277 5093 84 825 4450 9679 8860 1624 3159 3486 7699 5277 424 6615 1920 7201 9369 2389 258 7605 7387 5939 3354 5713 3615 3614 4369 1911 6738 7885 1667 1469...
output:
impossible
result:
ok OK!
Test #17:
score: 0
Accepted
time: 76ms
memory: 8392kb
input:
200000 10000 1502140000 653 7136 1249 5366 1127 9867 4407 7596 7667 8651 1926 4122 1944 9440 2657 9188 4534 5793 2093 1702 7957 5949 6913 7920 478 3452 526 8453 5083 5306 1993 867 5474 308 8344 8464 4311 6362 236 8465 749 381 1585 4924 8308 2835 8990 132 9321 8362 5617 3524 2433 3122 7942 6261 9708 ...
output:
32743 26670 20136 17715 41135 17186 7927 197925 61378 167668 154590 150799 100360 139703 135973 134887 102387 125858 118508 108305 103557 104545 104021 95948 110964 81093 61883 22097 115057 17070 12734 8857 164857 193536 178921 172623 165962 171644 167785 149093 168612 145581 129186 122291 171657 11...
result:
ok OK!
Test #18:
score: 0
Accepted
time: 88ms
memory: 8272kb
input:
200000 10000 1500340000 291 207 9762 2332 2180 1112 6177 9183 9776 4032 9699 7579 1824 9501 7608 7922 7715 7886 3299 1389 2529 8466 4144 1713 4971 6873 7305 1172 2203 8427 5959 7603 6485 2420 4351 7599 5266 8748 4280 8949 3501 4920 881 9516 7857 3105 5795 6619 5225 3659 6289 7983 3130 4485 9046 2842...
output:
46192 43462 41049 24558 51438 20369 186586 180708 52425 166686 163375 147802 61857 135475 126103 104621 67487 89470 72351 68619 78353 66976 62849 32615 102332 29046 19141 11129 103684 9370 8657 4344 115866 1478 184779 177359 120085 174892 157843 142629 127447 139963 92002 89210 153597 88109 78496 77...
result:
ok OK!
Test #19:
score: 0
Accepted
time: 71ms
memory: 8004kb
input:
200000 10000 1500700000 7149 4288 4642 8798 3889 8148 1944 8715 2911 8181 9295 9511 5370 6969 2300 2430 7281 3824 7923 4364 6242 2276 3747 7817 3517 6771 5995 4157 9918 5051 2738 2803 2134 4831 8287 9553 1986 3295 2984 6401 3145 434 8522 2375 1668 2493 9549 5135 2730 377 3715 4550 2934 4898 5974 761...
output:
impossible
result:
ok OK!
Test #20:
score: -100
Wrong Answer
time: 92ms
memory: 13072kb
input:
200000 10000 499880000 9661 2305 499 9638 9339 2149 5655 4275 847 7360 9708 5245 1900 8203 303 6493 1600 9072 9537 3333 92 3698 1275 1729 6630 4762 4687 222 7659 9563 6000 9153 5126 4850 2554 2198 55 3719 5780 9133 6160 6903 9371 7145 536 3378 1018 5626 8064 983 3094 5562 7444 6 7881 2294 5573 5713 ...
output:
95570 73357 103311 104937 108299 56936 111571 126071 166837 56519 174737 176321 178333 45374 7574 39992 49666 37588 57070 98890 128122 35761 180024 189005 15172 28422 19529 31224 31611 13840 39869 64952 68407 9782 73038 93157 98175 7291 103563 121760 127300 181269 127650 138531 146948 179332 152312 ...
result:
wrong answer Contestant printed a valid permutation, but it gave the wrong average score.