QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#443280 | #6762. Hotpot | ship2077 | AC ✓ | 4ms | 3972kb | C++17 | 870b | 2024-06-15 15:00:16 | 2024-06-15 15:00:31 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
constexpr int M=1e5+5;
int n,k,m,_,a[M],buc[M],ans[M];
int read(){
int x=0;char ch=getchar();
while (!isdigit(ch)) ch=getchar();
while (isdigit(ch)) x=x*10+ch-48,ch=getchar();
return x;
}
void solve(){
n=read();k=read();m=read();_=m/(n<<1);
for (int i=1;i<=n;i++) a[i]=read();
for (int i=1;i<=k;i++) buc[i]=0;
for (int i=1;i<=n;i++)
if (buc[a[i]]) ans[i]=_,buc[a[i]]=0;
else ans[i]=0,buc[a[i]]=1;
for (int i=1;i<=n;i++)
if (buc[a[i]]) ans[i]+=_,buc[a[i]]=0;
else buc[a[i]]=1; m%=n<<1;
for (int i=1;m&&i<=n;m--,i++)
if (buc[a[i]]) ans[i]++,buc[a[i]]=0;
else buc[a[i]]=1;
for (int i=1;m&&i<=n;m--,i++)
if (buc[a[i]]) ans[i]++,buc[a[i]]=0;
else buc[a[i]]=1;
for (int i=1;i<=n;i++) printf("%d%c",ans[i]," \n"[i==n]);
}
int main(){int T=read();while (T--) solve();return 0;}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3972kb
input:
4 3 2 6 1 1 2 1 1 5 1 2 2 10 1 2 2 2 10 1 1
output:
0 2 1 2 2 2 0 5
result:
ok 4 lines
Test #2:
score: 0
Accepted
time: 4ms
memory: 3856kb
input:
1000 2 73 291100997 46 23 40 2 11764377 1 2 2 2 1 2 2 2 1 2 2 2 2 1 1 1 2 2 2 1 2 2 1 1 1 1 1 1 1 1 1 1 2 1 2 1 2 2 1 1 29 20 781370886 4 9 7 4 10 4 1 6 19 15 20 9 20 18 7 4 7 13 18 4 13 13 10 15 15 9 20 5 3 53 95 911403367 44 41 65 63 37 8 15 9 47 83 44 91 23 89 59 60 5 19 77 24 73 35 30 79 1 94 92...
output:
72775249 72775249 147055 147055 147055 147055 147055 147055 147055 147055 147055 147055 147055 147055 147055 147055 147055 147055 147055 147055 147054 147054 147055 147054 147055 147054 147055 147054 147055 147054 147055 147054 147055 147054 147055 147055 147054 147054 147055 147054 147055 147054 13...
result:
ok 1000 lines
Test #3:
score: 0
Accepted
time: 4ms
memory: 3784kb
input:
1000 99 47 124340092 21 46 33 43 43 26 47 15 27 13 1 38 23 7 33 4 16 38 18 22 18 5 39 24 11 43 4 10 12 27 3 20 6 9 9 27 35 29 39 46 2 13 43 18 34 6 38 7 2 40 28 13 27 2 43 37 28 7 22 30 7 39 27 2 2 25 2 14 39 3 14 34 41 44 25 40 37 3 18 27 39 6 36 38 41 33 35 38 17 43 2 35 26 24 22 18 38 11 24 78 96...
output:
627980 0 627980 0 1255961 0 627980 627980 0 627980 627980 0 627980 0 627981 0 627980 1255961 627980 627980 627981 627980 627980 627980 0 0 1255961 627980 627980 1255961 627980 627980 627980 0 1255961 0 627980 627980 627981 1255961 627980 627981 1255961 627980 0 627981 0 1255961 627981 0 0 627980 125...
result:
ok 1000 lines
Test #4:
score: 0
Accepted
time: 2ms
memory: 3844kb
input:
1000 22 80 473259206 39 49 44 59 45 40 73 68 53 28 63 59 50 24 45 15 7 38 62 59 79 76 69 65 947050582 58 40 12 47 3 60 25 3 19 5 46 27 44 40 55 25 5 5 15 56 29 45 30 31 26 58 25 24 13 62 37 63 5 60 11 56 12 43 25 65 55 59 11 28 58 7 65 4 54 18 48 20 10 6 14 39 63 6 16 19 18 57 14 26 20 14 1 2 39 12 ...
output:
10755891 10755891 10755891 10755891 0 10755891 10755891 10755891 10755891 10755891 10755891 10755891 10755891 10755891 21511782 10755891 10755891 10755891 10755891 10755891 10755891 10755891 6862685 0 0 6862685 0 0 0 13725371 0 0 6862685 6862685 6862685 13725371 0 13725371 13725371 0 6862685 0 68626...
result:
ok 1000 lines
Test #5:
score: 0
Accepted
time: 4ms
memory: 3792kb
input:
1000 93 7 44 7 5 5 2 3 6 3 5 2 4 5 5 7 4 5 1 6 3 7 6 1 7 7 7 6 7 6 4 4 1 3 6 6 2 1 3 4 6 7 3 1 2 5 3 1 5 1 2 2 4 5 2 4 1 4 6 3 6 2 7 1 2 1 3 2 2 1 5 6 7 6 1 7 1 2 5 2 6 1 6 5 3 4 6 1 5 5 5 5 6 5 6 3 66 1 34 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:
0 0 1 0 0 0 1 0 1 0 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 0 0 1 0 1 1 0 0 1 0 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 1000 lines
Test #6:
score: 0
Accepted
time: 1ms
memory: 3844kb
input:
1000 2 1 560 1 1 1 9 362 2 9 9 413 9 9 6 2 4 6 5 8 7 2 4 422 3 1 4 5 851 1 1 3 4 9 8 536 4 3 2 1 1 7 8 6 3 1 5 646 3 2 1 293 1 1 8 8 451 4 6 8 1 7 5 5 5 6 4 150 3 1 4 3 1 2 9 8 994 1 5 1 6 5 4 1 7 7 6 3 460 3 3 3 1 3 1 6 8 536 7 2 8 1 6 1 2 7 58 3 5 9 6 615 1 5 1 4 4 6 1 1 5 3 9 256 6 8 4 9 7 684 4 ...
output:
0 280 181 0 46 0 23 23 46 23 23 22 105 105 0 213 106 106 30 0 30 0 60 29 29 29 59 323 0 146 28 28 28 28 28 28 28 28 0 0 12 25 25 12 55 0 56 55 110 55 55 0 110 0 77 0 0 76 76 45 45 44 0 44 89 14 14 0 0 69 0 68 34 0 68 68 43 42 42 0 0 38 76 0 76 38 76 38 0 12 24 12 12 12 0 1 0 1 8 8 0 16 8 8 0 296 240...
result:
ok 1000 lines
Test #7:
score: 0
Accepted
time: 1ms
memory: 3852kb
input:
1000 4 6 556 4 3 3 6 5 5 188 5 1 4 1 5 4 3 7 2 2 3 1 3 8 131 1 8 6 5 5 788 3 5 2 5 4 9 9 861 4 4 9 7 6 1 7 6 1 10 3 937 3 1 1 1 3 3 3 1 1 2 3 6 289 5 5 2 6 7 32 1 6 2 3 5 5 8 10 489 1 7 9 6 4 4 2 10 1 2 876 1 10 2 398 1 2 2 2 2 2 2 2 2 1 9 6 885 6 2 3 4 3 3 1 4 1 1 10 131 4 6 6 131 2 1 2 6 5 3 8 5 9...
output:
69 0 139 69 0 0 19 37 37 0 2 1 0 22 22 21 79 0 79 157 78 0 96 48 0 0 0 95 95 95 0 47 47 47 94 0 94 47 46 46 0 96 48 3 3 2 2 0 5 31 30 30 30 0 61 30 30 438 0 0 40 0 40 0 40 0 39 39 49 49 49 0 49 49 0 98 98 65 0 11 22 11 11 10 60 0 61 60 60 121 60 60 10 10 10 10 0 29 59 0 59 0 29 29 29 58 0 0 46 22 22...
result:
ok 1000 lines
Test #8:
score: 0
Accepted
time: 4ms
memory: 3748kb
input:
100 92 249 416468 144 191 140 7 190 63 119 63 19 68 201 206 245 53 127 54 121 108 66 156 222 176 96 136 98 104 237 238 213 95 30 22 183 156 236 40 60 105 97 125 40 241 1 168 218 41 231 205 159 232 38 241 228 182 82 51 199 72 138 130 234 201 88 48 91 130 73 219 131 98 133 187 220 34 133 197 225 97 11...
output:
2263 2263 2263 0 2263 0 2263 4527 2263 2263 0 2263 2263 2263 2263 2263 2263 2263 2263 0 2263 0 2263 2263 0 2263 2263 2263 2263 2263 2263 2263 2263 4527 2263 0 2263 2263 0 2263 4527 0 2263 2263 2263 2263 0 2263 0 2263 2263 4527 0 2263 0 2263 2263 2263 0 0 2263 4527 2263 2263 2263 4527 2263 2263 2263 ...
result:
ok 100 lines
Test #9:
score: 0
Accepted
time: 4ms
memory: 3840kb
input:
100 618 971 5084361 156 140 368 626 451 71 389 782 97 872 242 232 252 552 838 771 92 505 404 436 630 493 255 525 649 678 560 855 362 388 733 406 527 303 620 493 890 360 326 849 651 906 57 721 439 941 88 512 592 401 441 323 653 620 919 363 13 89 206 85 592 450 642 107 232 152 747 283 633 87 725 962 7...
output:
0 4114 4114 4114 0 4114 0 0 0 0 0 4114 4114 4114 0 4114 4114 0 4114 4114 0 0 4114 4114 4114 4114 4114 4114 4114 4114 0 0 4114 4114 4114 8228 4114 0 4114 4114 4114 4114 0 4114 4114 0 4114 0 4114 4114 4114 4114 0 4114 4114 0 0 4114 0 0 4114 4114 0 0 4114 0 4114 0 4114 4114 0 4114 0 4114 4114 0 4113 41...
result:
ok 100 lines