QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#471633 | #8903. Тайное послание | Kevin5307 | 9 | 167ms | 33764kb | C++23 | 1.2kb | 2024-07-10 23:45:52 | 2024-07-10 23:45:54 |
Judging History
answer
//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int tp;
cin>>tp;
int t;
cin>>t;
while(t--)
{
int n,k;
cin>>n>>k;
vector<int> vec;
map<int,int> Mp;
for(int i=1;i<=k;i++)
{
int x;
cin>>x;
if(tp==2) x=n+1-x;
vec.pb(x);
}
srt(vec);
for(auto x:vec)
Mp[x]=1;
int p=vec[0];
vector<int> ans;
for(auto x:vec)
{
p=max(p,x);
while(Mp[(p-1)%n+1])
p++;
Mp[(p-1)%n+1]=1;
ans.pb((p-1)%n+1);
}
srt(ans);
for(auto x:ans)
cout<<(tp==1?x:n+1-x)<<" ";
cout<<'\n';
}
return 0;
}
詳細信息
Subtask #1:
score: 9
Accepted
Test #1:
score: 9
Accepted
time: 0ms
memory: 3596kb
input:
1 1 5000 1 1666
output:
1667
input:
2 1 5000 1 1667
output:
1666
result:
ok correct! (1 test case)
Test #2:
score: 9
Accepted
time: 0ms
memory: 3624kb
input:
1 1 5000 1 4081
output:
4082
input:
2 1 5000 1 4082
output:
4081
result:
ok correct! (1 test case)
Test #3:
score: 9
Accepted
time: 0ms
memory: 3620kb
input:
1 500 8 1 1 9 1 6 7 1 5 7 1 2 8 1 6 5 1 5 8 1 7 5 1 3 6 1 2 9 1 2 8 1 6 10 1 5 5 1 2 10 1 2 9 1 3 4 1 2 10 1 3 7 1 4 10 1 2 4 1 3 6 1 1 6 1 2 5 1 1 6 1 2 8 1 1 8 1 8 10 1 3 6 1 1 8 1 1 9 1 5 10 1 1 4 1 3 10 1 8 5 1 5 10 1 9 6 1 1 10 1 1 9 1 5 7 1 5 9 1 3 7 1 1 7 1 5 5 1 4 6 1 1 6 1 3 8 1 1 4 1 1 9 1...
output:
2 7 6 3 7 1 8 4 3 3 7 6 3 3 4 3 4 5 3 4 2 3 2 3 2 1 4 2 2 6 2 4 9 1 10 2 2 6 6 4 2 6 5 2 4 2 2 3 7 3 3 4 5 1 8 5 3 2 7 1 4 4 2 1 1 5 1 1 7 5 1 1 4 1 9 4 3 2 4 4 4 1 7 2 4 5 3 3 6 5 4 6 1 2 2 6 5 2 7 4 ...
input:
2 500 6 1 2 5 1 4 7 1 2 8 1 6 9 1 3 4 1 2 9 1 2 9 1 8 7 1 5 10 1 4 8 1 4 10 1 3 5 1 2 10 1 6 10 1 8 6 1 6 4 1 4 4 1 2 8 1 6 6 1 1 5 1 4 5 1 5 8 1 8 6 1 3 8 1 2 5 1 1 10 1 5 6 1 5 6 1 3 6 1 1 6 1 4 6 1 1 10 1 10 7 1 3 6 1 1 6 1 3 10 1 5 5 1 1 8 1 2 7 1 5 9 1 8 9 1 4 6 1 4 5 1 2 6 1 2 7 1 6 6 1 2 6 1 ...
output:
1 3 1 5 2 1 1 7 4 3 3 2 1 5 7 5 3 1 5 6 3 4 7 2 1 5 4 4 2 6 3 6 9 2 6 2 4 5 1 4 7 3 3 1 1 5 1 1 5 5 6 4 4 7 10 3 7 5 5 3 3 1 6 4 6 6 3 7 2 1 8 5 1 6 4 7 3 8 2 4 2 1 1 2 3 1 5 8 3 2 6 4 1 4 2 5 4 3 5 2 ...
result:
ok correct! (500 test cases)
Test #4:
score: 9
Accepted
time: 0ms
memory: 3828kb
input:
1 100 5 1 1 38 1 31 6 1 3 32 1 12 49 1 7 21 1 8 15 1 5 10 1 7 11 1 3 31 1 1 19 1 8 9 1 3 27 1 27 36 1 18 13 1 12 17 1 6 18 1 16 46 1 21 36 1 1 13 1 3 44 1 34 29 1 5 19 1 1 43 1 7 22 1 19 39 1 36 19 1 2 4 1 3 36 1 26 44 1 4 6 1 5 47 1 29 23 1 8 7 1 7 45 1 35 37 1 9 18 1 11 2 1 1 44 1 3 22 1 22 43 1 9...
output:
2 32 4 13 8 9 6 8 4 2 9 4 1 19 13 7 17 22 2 4 35 6 2 8 20 37 3 4 27 5 6 30 9 1 36 10 12 2 4 1 10 1 7 34 17 2 26 14 6 11 15 3 1 1 3 6 3 4 3 28 10 24 4 7 9 35 9 38 4 6 37 22 18 35 3 26 3 4 3 7 5 3 2 2 10 27 30 13 9...
input:
2 100 5 1 4 3 1 3 49 1 8 18 1 12 13 1 7 23 1 9 44 1 27 30 1 10 20 1 3 38 1 38 13 1 4 30 1 7 31 1 2 19 1 9 36 1 19 46 1 22 31 1 13 22 1 20 10 1 8 19 1 2 22 1 1 44 1 5 3 1 1 21 1 6 5 1 2 6 1 3 44 1 4 36 1 27 27 1 1 37 1 10 28 1 24 7 1 6 24 1 10 20 1 6 15 1 6 33 1 26 11 1 7 8 1 2 17 1 7 14 1 12 36 1 30...
output:
3 2 7 11 6 8 26 9 2 37 3 6 1 8 18 21 12 19 7 1 22 4 3 5 1 2 3 26 27 9 23 5 9 5 5 25 6 1 6 11 29 2 12 21 8 8 3 1 34 2 2 23 36 2 29 5 34 34 12 2 7 1 13 5 3 8 33 1 1 10 4 2 9 2 1 17 13 7 3 1 25 36 21 16 3 14 2 8 2 ...
result:
ok correct! (100 test cases)
Subtask #2:
score: 0
Wrong Answer
Test #5:
score: 0
Wrong Answer
time: 0ms
memory: 3816kb
input:
1 1 5000 2 90 2207
output:
91 2208
input:
2 1 5000 2 91 2208
output:
2207 90
result:
wrong answer Integer parameter [name=R_i] equals to 2207, violates the range [90, 90] (test case 1)
Subtask #3:
score: 0
Wrong Answer
Test #10:
score: 0
Wrong Answer
time: 120ms
memory: 18544kb
input:
1 1 300000 150000 4 6 7 8 9 10 17 19 20 23 25 28 32 33 36 41 45 46 51 53 56 58 60 61 62 64 65 66 67 68 69 71 72 73 75 77 88 90 92 93 97 99 100 101 107 108 110 111 112 113 117 118 121 122 123 124 126 130 131 138 139 140 142 144 149 150 151 153 155 158 159 160 161 165 168 172 173 174 177 183 184 185 1...
output:
1 2 3 5 11 12 13 14 15 16 18 21 22 24 26 27 29 30 31 34 35 37 38 39 40 42 43 44 47 48 49 50 52 54 55 57 59 63 70 74 76 78 79 80 81 82 83 84 85 86 87 89 91 94 95 96 98 102 103 104 105 106 109 114 115 116 119 120 125 127 128 129 132 133 134 135 136 137 141 143 145 146 147 148 152 154 156 157 162 163 1...
input:
2 1 300000 150000 1 2 3 5 11 12 13 14 15 16 18 21 22 24 26 27 29 30 31 34 35 37 38 39 40 42 43 44 47 48 49 50 52 54 55 57 59 63 70 74 76 78 79 80 81 82 83 84 85 86 87 89 91 94 95 96 98 102 103 104 105 106 109 114 115 116 119 120 125 127 128 129 132 133 134 135 136 137 141 143 145 146 147 148 152 154...
output:
299999 299998 299997 299995 299993 299992 299991 299989 299988 299986 299985 299982 299981 299979 299978 299976 299975 299973 299971 299970 299969 299968 299966 299961 299960 299959 299957 299953 299952 299951 299950 299949 299947 299946 299945 299944 299942 299941 299940 299937 299936 299932 299929...
result:
wrong answer Integer parameter [name=R_i] equals to 299999, violates the range [4, 4] (test case 1)
Subtask #4:
score: 0
Wrong Answer
Test #16:
score: 0
Wrong Answer
time: 1ms
memory: 3828kb
input:
1 714 4 1 4 5 2 2 5 4 2 1 2 4 2 3 4 3 1 3 7 2 2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result:
wrong answer Integer parameter [name=R_i] equals to 2, violates the range [1, 1] (test case 5)
Subtask #5:
score: 0
Wrong Answer
Test #17:
score: 0
Wrong Answer
time: 166ms
memory: 33736kb
input:
1 1 1000000000 300000 884 1150 3663 8801 12244 12286 12380 12406 15958 18962 23631 23706 26157 30339 30374 34575 37125 48953 50417 51665 54114 54300 55776 58495 63402 63487 67516 69176 70683 72867 73468 74810 80999 87487 93187 97368 97544 97891 101280 105464 110296 122351 124949 131540 136869 136936...
output:
885 1151 3664 8802 12245 12287 12381 12407 15959 18963 23632 23707 26158 30340 30375 34576 37126 48954 50418 51666 54115 54301 55777 58496 63403 63488 67517 69177 70684 72868 73469 74811 81000 87488 93188 97369 97545 97892 101281 105465 110297 122352 124950 131541 136870 136937 141504 143256 146417 ...
input:
2 1 1000000000 300000 885 1151 3664 8802 12245 12287 12381 12407 15959 18963 23632 23707 26158 30340 30375 34576 37126 48954 50418 51666 54115 54301 55777 58496 63403 63488 67517 69177 70684 72868 73469 74811 81000 87488 93188 97369 97545 97892 101281 105465 110297 122352 124950 131541 136870 136937...
output:
999990199 999984897 999974552 999967718 999966254 999964811 999964713 999963491 999957195 999956861 999952644 999950646 999944691 999942293 999938804 999936876 999935849 999930433 999928022 999924809 999923614 999920096 999919028 999914442 999913362 999910984 999908860 999906720 999892667 999891789 ...
result:
wrong answer Integer parameter [name=R_i] equals to 999990199, violates the range [884, 884] (test case 1)
Subtask #6:
score: 0
Wrong Answer
Test #30:
score: 0
Wrong Answer
time: 167ms
memory: 33764kb
input:
1 1 1000000000 300000 408756052 408756979 408759607 408760032 408760051 408761093 408761416 408761494 408761726 408764755 408767605 408776555 408778463 408781171 408781316 408782320 408785971 408787248 408787812 408790957 408791686 408794839 408794850 408796477 408797483 408799152 408799165 40879929...
output:
408756053 408756980 408759608 408760033 408760052 408761094 408761417 408761495 408761727 408764756 408767606 408776556 408778464 408781172 408781317 408782321 408785972 408787249 408787813 408790958 408791687 408794840 408794851 408796478 408797484 408799153 408799166 408799299 408806129 408809966 ...
input:
2 1 1000000000 300000 408756053 408756980 408759608 408760033 408760052 408761094 408761417 408761495 408761727 408764756 408767606 408776556 408778464 408781172 408781317 408782321 408785972 408787249 408787813 408790958 408791687 408794840 408794851 408796478 408797484 408799153 408799166 40879929...
output:
908755032 908754857 908753816 908753354 908750747 908750071 908749405 908748866 908747954 908744532 908743031 908740856 908739922 908737125 908736186 908734850 908734003 908732312 908728890 908728783 908728175 908726875 908722726 908722087 908721706 908718561 908718236 908717885 908716551 908712695 ...
result:
wrong answer Integer parameter [name=R_i] equals to 908755032, violates the range [408756052, 408756052] (test case 1)
Subtask #7:
score: 0
Wrong Answer
Test #45:
score: 0
Wrong Answer
time: 1ms
memory: 3980kb
input:
1 1 5000 1000 8 12 13 25 39 41 44 46 47 48 50 51 54 56 60 64 68 70 72 76 80 89 90 97 99 103 110 112 117 118 119 122 123 131 132 133 134 141 157 166 170 173 189 190 192 195 196 197 210 218 220 222 223 229 235 238 240 249 251 252 254 266 267 270 274 276 282 286 288 291 292 293 294 295 305 306 307 309 ...
output:
9 14 15 26 40 42 45 49 52 53 55 57 58 59 61 65 69 71 73 77 81 91 92 98 100 104 111 113 120 121 124 125 126 135 136 137 138 142 158 167 171 174 191 193 194 198 199 200 211 219 221 224 225 230 236 239 241 250 253 255 256 268 269 271 275 277 283 287 289 296 297 298 299 300 308 311 312 313 314 317 322 3...
input:
2 1 5000 1000 9 14 15 26 40 42 45 49 52 53 55 57 58 59 61 65 69 71 73 77 81 91 92 98 100 104 111 113 120 121 124 125 126 135 136 137 138 142 158 167 171 174 191 193 194 198 199 200 211 219 221 224 225 230 236 239 241 250 253 255 256 268 269 271 275 277 283 287 289 296 297 298 299 300 308 311 312 313...
output:
4000 3996 3991 3988 3980 3973 3971 3969 3966 3965 3961 3948 3935 3933 3929 3927 3924 3918 3917 3913 3908 3905 3903 3896 3891 3888 3886 3885 3873 3871 3860 3858 3856 3851 3850 3849 3844 3840 3839 3835 3830 3827 3826 3825 3822 3821 3817 3816 3810 3806 3803 3800 3797 3787 3778 3776 3770 3761 3759 3758 ...
result:
wrong answer Integer parameter [name=R_i] equals to 4000, violates the range [8, 8] (test case 1)
Subtask #8:
score: 0
Wrong Answer
Test #55:
score: 0
Wrong Answer
time: 0ms
memory: 3660kb
input:
1 1 100 30 1 8 9 10 12 17 22 24 25 27 28 29 32 33 34 42 45 47 50 52 54 56 62 71 79 81 85 86 90 94
output:
2 11 13 14 15 18 23 26 30 31 35 36 37 38 39 43 46 48 51 53 55 57 63 72 80 82 87 88 91 95
input:
2 1 100 30 2 11 13 14 15 18 23 26 30 31 35 36 37 38 39 43 46 48 51 53 55 57 63 72 80 82 87 88 91 95
output:
94 90 86 85 81 79 71 62 56 54 52 50 47 45 42 34 33 32 29 28 27 25 24 22 17 12 10 9 8 1
result:
wrong answer Integer parameter [name=R_i] equals to 94, violates the range [1, 1] (test case 1)
Subtask #9:
score: 0
Skipped
Subtask #10:
score: 0
Skipped
Subtask #11:
score: 0
Skipped
Subtask #12:
score: 0
Skipped