| Task: | Island |
| Sender: | Diego_09 |
| Submission time: | 2026-04-16 11:46:57 +0300 |
| Language: | C++ (C++17) |
| Status: | READY |
| Result: | 0 |
| subtask | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| #2 | WRONG ANSWER | 0 |
| #3 | WRONG ANSWER | 0 |
| #4 | WRONG ANSWER | 0 |
| #5 | WRONG ANSWER | 0 |
| test | verdict | time | subtask | |
|---|---|---|---|---|
| #1 | WRONG ANSWER | 0.00 s | 1, 5 | details |
| #2 | WRONG ANSWER | 0.00 s | 1, 2, 3, 4, 5 | details |
| #3 | WRONG ANSWER | 0.00 s | 1, 5 | details |
| #4 | WRONG ANSWER | 0.01 s | 1, 5 | details |
| #5 | WRONG ANSWER | 0.00 s | 1, 3, 5 | details |
| #6 | WRONG ANSWER | 0.00 s | 1, 2, 4, 5 | details |
| #7 | WRONG ANSWER | 0.01 s | 1, 2, 4, 5 | details |
| #8 | WRONG ANSWER | 0.00 s | 1, 5 | details |
| #9 | WRONG ANSWER | 0.00 s | 1, 5 | details |
| #10 | WRONG ANSWER | 0.00 s | 1, 3, 4, 5 | details |
| #11 | WRONG ANSWER | 0.01 s | 1, 3, 5 | details |
| #12 | WRONG ANSWER | 0.00 s | 1, 4, 5 | details |
| #13 | WRONG ANSWER | 0.00 s | 1, 3, 4, 5 | details |
| #14 | WRONG ANSWER | 0.01 s | 1, 4, 5 | details |
| #15 | WRONG ANSWER | 0.00 s | 1, 5 | details |
| #16 | WRONG ANSWER | 0.00 s | 1, 5 | details |
| #17 | WRONG ANSWER | 0.00 s | 1, 5 | details |
| #18 | WRONG ANSWER | 0.00 s | 1, 5 | details |
| #19 | WRONG ANSWER | 0.89 s | 2, 4, 5 | details |
| #20 | WRONG ANSWER | 0.89 s | 2, 4, 5 | details |
| #21 | WRONG ANSWER | 0.89 s | 2, 4, 5 | details |
| #22 | WRONG ANSWER | 0.89 s | 2, 4, 5 | details |
| #23 | WRONG ANSWER | 0.89 s | 3, 5 | details |
| #24 | WRONG ANSWER | 0.90 s | 3, 5 | details |
| #25 | WRONG ANSWER | 0.89 s | 3, 5 | details |
| #26 | WRONG ANSWER | 0.90 s | 3, 5 | details |
| #27 | WRONG ANSWER | 0.94 s | 3, 4, 5 | details |
| #28 | WRONG ANSWER | 0.89 s | 3, 4, 5 | details |
| #29 | WRONG ANSWER | 0.89 s | 4, 5 | details |
| #30 | WRONG ANSWER | 0.90 s | 4, 5 | details |
| #31 | WRONG ANSWER | 0.89 s | 4, 5 | details |
| #32 | WRONG ANSWER | 0.89 s | 4, 5 | details |
| #33 | WRONG ANSWER | 0.89 s | 4, 5 | details |
| #34 | WRONG ANSWER | 0.91 s | 4, 5 | details |
| #35 | WRONG ANSWER | 0.89 s | 5 | details |
| #36 | WRONG ANSWER | 0.90 s | 5 | details |
| #37 | WRONG ANSWER | 0.89 s | 5 | details |
| #38 | WRONG ANSWER | 0.90 s | 5 | details |
| #39 | WRONG ANSWER | 0.90 s | 5 | details |
| #40 | WRONG ANSWER | 0.89 s | 5 | details |
| #41 | WRONG ANSWER | 0.90 s | 5 | details |
| #42 | WRONG ANSWER | 0.89 s | 5 | details |
| #43 | WRONG ANSWER | 0.89 s | 5 | details |
| #44 | WRONG ANSWER | 0.89 s | 5 | details |
Compiler report
input/code.cpp: In function 'void solve()':
input/code.cpp:52:21: warning: variable 'eq' set but not used [-Wunused-but-set-variable]
52 | int mid=-1,c1=0,eq=1;
| ^~
input/code.cpp: In function 'void set_io(std::string)':
input/code.cpp:31:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
31 | freopen((name+".in").c_str(),"r",stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
input/code.cpp:32:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
32 | freopen((name+".out").c_str(),"w",stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Code
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#if defined(__has_include)&&__has_include("custom_h/debugging.h")
#define local_run 1
#include "custom_h\debugging.h"
#else
#define local_run 0
#endif
// #pragma GCC target ("avx2");
// #pragma GCC optimize ("Ofast");
#define rall(v) v.rbegin(),v.rend()
#define all(v) v.begin(),v.end()
#define keyval find_by_order
#define valkey order_of_key
#define int long long
#define pb push_back
#define s second
#define f first
using namespace __gnu_pbds;
using namespace std;
template<typename T>
using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
template<typename T>
using omset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;
void set_io(string name=""){
ios_base::sync_with_stdio(0);cin.tie(0);
if(name.size() and !local_run){
freopen((name+".in").c_str(),"r",stdin);
freopen((name+".out").c_str(),"w",stdout);
}
}
const int my[]={0,0,1,-1,1,1,-1,-1};
const int mx[]={1,-1,0,0,1,-1,-1,1};
const int md=1e9+7;
const int oo=1e18;
void solve(){
int n,k;
cin>>n>>k;
vector<int>a(n),cant(k+1,0LL);
for(int &i:a){
cin>>i;
cant[i]++;
}
int mid=-1,c1=0,eq=1;
for(int i=1;i<=k;i++){
if(cant[i]%2==1){
mid=i;
c1++;
}
if(i>0 and cant[i]!=cant[i-1])eq=0;
}
if(n<=10){
do{
vector<int>sum(k+1,0);
bool ok=1;
for(int i=0;i<n;i++)sum[a[i]]+=i+1;
for(int i=1;i<=k;i++)if(sum[i]*2!=(n+1)*cant[i])ok=0;
if(ok){
cout<<"YES\n";
for(int i:a)cout<<i<<" ";
cout<<"\n";
return;
}
}while(next_permutation(all(a)));
cout<<"NO\n";
return;
}
// if(c1<=1){
vector<int>ans;
for(int i=1;i<=k;i++){
if(i==mid)continue;
for(int j=0;j<cant[i]/2;j++)ans.pb(i);
}
if(mid!=-1){
for(int j=0;j<cant[mid];j++)ans.pb(mid);
}
for(int i=k;i>=1;i--){
if(i==mid)continue;
for(int j=0;j<cant[i]/2;j++)ans.pb(i);
}
if(n%2==0){
if(mid==-1){
cout<<"YES\n";
for(int i:ans)cout<<i<<" ";
cout<<"\n";
return;
}
cout<<"NO\n";
}else{
if(mid!=0){
cout<<"YES\n";
for(int i:ans)cout<<i<<" ";
cout<<"\n";
return;
}
cout<<"NO\n";
}
return;
// }
}
int32_t main(){set_io("");
int t=1;
cin>>t;
while(t--){
solve();
}
}Test details
Test 1
Subtask: 1, 5
Verdict: WRONG ANSWER
| input |
|---|
| 8 4 ........ ..####.. .##.###. .##.###. ... |
| correct output |
|---|
| 5 0 17 3 |
| user output |
|---|
| YES 0 0 0 0 YES 0 0 0 0 YES ... |
Feedback: Output is longer than expected
Test 2
Subtask: 1, 2, 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 3 1 ... .#. ... 2 2 2 2 |
| correct output |
|---|
| 0 |
| user output |
|---|
| YES 0 YES 0 YES ... |
Feedback: Output is longer than expected
Test 3
Subtask: 1, 5
Verdict: WRONG ANSWER
| input |
|---|
| 199 196 ................................. |
| correct output |
|---|
| 468 605 825 532 496 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is longer than expected
Test 4
Subtask: 1, 5
Verdict: WRONG ANSWER
| input |
|---|
| 200 200 ................................. |
| correct output |
|---|
| 112 347 142 459 239 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Incorrect character on line 1 col 1: expected "112", got "YES"
Test 5
Subtask: 1, 3, 5
Verdict: WRONG ANSWER
| input |
|---|
| 200 200 ................................. |
| correct output |
|---|
| 381 544 94 532 98 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Incorrect character on line 1 col 1: expected "381", got "YES"
Test 6
Subtask: 1, 2, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 200 200 ................................. |
| correct output |
|---|
| 133 73 81 82 53 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Incorrect character on line 1 col 1: expected "133", got "YES"
Test 7
Subtask: 1, 2, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 200 200 ................................. |
| correct output |
|---|
| 139 52 101 14 144 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Incorrect character on line 1 col 1: expected "139", got "YES"
Test 8
Subtask: 1, 5
Verdict: WRONG ANSWER
| input |
|---|
| 200 200 ................................. |
| correct output |
|---|
| 236 555 878 632 829 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Incorrect character on line 1 col 1: expected "236", got "YES"
Test 9
Subtask: 1, 5
Verdict: WRONG ANSWER
| input |
|---|
| 200 200 ................................. |
| correct output |
|---|
| 425 296 698 577 422 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Incorrect character on line 1 col 1: expected "425", got "YES"
Test 10
Subtask: 1, 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 200 200 ................................. |
| correct output |
|---|
| 1365 7284 11808 6136 9283 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Incorrect character on line 1 col 1: expected "1365", got "YES"
Test 11
Subtask: 1, 3, 5
Verdict: WRONG ANSWER
| input |
|---|
| 200 200 ................................. |
| correct output |
|---|
| 6292 17954 16728 8938 1335 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Incorrect character on line 1 col 1: expected "6292", got "YES"
Test 12
Subtask: 1, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 200 200 ................................. |
| correct output |
|---|
| 27 141 269 127 61 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Incorrect character on line 1 col 1: expected "27", got "YES"
Test 13
Subtask: 1, 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 200 200 ................................. |
| correct output |
|---|
| 19552 19544 19478 19402 19456 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Incorrect character on line 1 col 1: expected "19552", got "YES"
Test 14
Subtask: 1, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 200 200 ................................. |
| correct output |
|---|
| 17624 17515 17468 17689 17510 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Incorrect character on line 1 col 1: expected "17624", got "YES"
Test 15
Subtask: 1, 5
Verdict: WRONG ANSWER
| input |
|---|
| 200 200 ................................. |
| correct output |
|---|
| 1584 1433 567 2248 1030 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Incorrect character on line 1 col 1: expected "1584", got "YES"
Test 16
Subtask: 1, 5
Verdict: WRONG ANSWER
| input |
|---|
| 200 200 ................................. |
| correct output |
|---|
| 5872 6374 60 323 5311 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Incorrect character on line 1 col 1: expected "5872", got "YES"
Test 17
Subtask: 1, 5
Verdict: WRONG ANSWER
| input |
|---|
| 200 200 ................................. |
| correct output |
|---|
| 1852 213 252 3861 1835 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Incorrect character on line 1 col 1: expected "1852", got "YES"
Test 18
Subtask: 1, 5
Verdict: WRONG ANSWER
| input |
|---|
| 200 200 ................................. |
| correct output |
|---|
| 1564 2709 866 1318 1758 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Incorrect character on line 1 col 1: expected "1564", got "YES"
Test 19
Subtask: 2, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 997 100000 ................................. |
| correct output |
|---|
| 150 531 370 518 508 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
Test 20
Subtask: 2, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 1000 100000 ................................. |
| correct output |
|---|
| 390 278 783 1269 249 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
Test 21
Subtask: 2, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 1000 100000 ................................. |
| correct output |
|---|
| 63 142 813 683 731 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
Test 22
Subtask: 2, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 1000 100000 ................................. |
| correct output |
|---|
| 949 876 1209 494 1033 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
Test 23
Subtask: 3, 5
Verdict: WRONG ANSWER
| input |
|---|
| 997 100000 ................................. |
| correct output |
|---|
| 714 2683 3699 2085 7850 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
Test 24
Subtask: 3, 5
Verdict: WRONG ANSWER
| input |
|---|
| 1000 100000 ................................. |
| correct output |
|---|
| 5081 1819 1050 4610 528 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
Test 25
Subtask: 3, 5
Verdict: WRONG ANSWER
| input |
|---|
| 1000 100000 ................................. |
| correct output |
|---|
| 3554 6322 6648 2882 1490 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
Test 26
Subtask: 3, 5
Verdict: WRONG ANSWER
| input |
|---|
| 1000 100000 ................................. |
| correct output |
|---|
| 433976 81646 87810 48080 110879 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
Test 27
Subtask: 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 1000 100000 ................................. |
| correct output |
|---|
| 207982 140036 208364 51912 56826 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
Test 28
Subtask: 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 1000 100000 ................................. |
| correct output |
|---|
| 497525 497563 498000 496804 497335 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
Test 29
Subtask: 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 1000 100000 ................................. |
| correct output |
|---|
| 38580 2097 9795 38033 1639 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
Test 30
Subtask: 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 1000 100000 ................................. |
| correct output |
|---|
| 33 20900 25028 1782 13599 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
Test 31
Subtask: 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 1000 100000 ................................. |
| correct output |
|---|
| 1421 1122 1840 834 443 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
Test 32
Subtask: 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 1000 100000 ................................. |
| correct output |
|---|
| 1378 1751 2274 250 811 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
Test 33
Subtask: 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 1000 100000 ................................. |
| correct output |
|---|
| 1126 886 544 223 272 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
Test 34
Subtask: 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 1000 100000 ................................. |
| correct output |
|---|
| 327286 447779 447534 448307 446997 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
Test 35
Subtask: 5
Verdict: WRONG ANSWER
| input |
|---|
| 1000 100000 ................................. |
| correct output |
|---|
| 2597 1473 1933 2691 1837 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
Test 36
Subtask: 5
Verdict: WRONG ANSWER
| input |
|---|
| 1000 100000 ................................. |
| correct output |
|---|
| 553 4357 3147 6951 1573 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
Test 37
Subtask: 5
Verdict: WRONG ANSWER
| input |
|---|
| 1000 100000 ................................. |
| correct output |
|---|
| 1723 2039 1871 5638 4256 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
Test 38
Subtask: 5
Verdict: WRONG ANSWER
| input |
|---|
| 1000 100000 ................................. |
| correct output |
|---|
| 1546 704 2796 3802 1870 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
Test 39
Subtask: 5
Verdict: WRONG ANSWER
| input |
|---|
| 1000 100000 ................................. |
| correct output |
|---|
| 3115 2042 2083 3227 740 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
Test 40
Subtask: 5
Verdict: WRONG ANSWER
| input |
|---|
| 1000 100000 ................................. |
| correct output |
|---|
| 5222 3211 5230 1772 2310 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
Test 41
Subtask: 5
Verdict: WRONG ANSWER
| input |
|---|
| 1000 100000 ................................. |
| correct output |
|---|
| 159214 68851 200821 141404 145704 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
Test 42
Subtask: 5
Verdict: WRONG ANSWER
| input |
|---|
| 1000 100000 ................................. |
| correct output |
|---|
| 1843 25028 124430 84542 131339 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
Test 43
Subtask: 5
Verdict: WRONG ANSWER
| input |
|---|
| 1000 100000 ................................. |
| correct output |
|---|
| 111206 75799 12026 142133 20483 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
Test 44
Subtask: 5
Verdict: WRONG ANSWER
| input |
|---|
| 1000 100000 ................................. |
| correct output |
|---|
| 20360 9075 12187 54923 54574 ... |
| user output |
|---|
| YES YES YES ... |
Feedback: Output is shorter than expected
