WA 93pts求助
查看原帖
WA 93pts求助
1017537
__yxfg__楼主2023/12/13 23:08
#include<bits/stdc++.h>
using namespace std;
const int N = 1e4+10;

int n,m;
int A[N],B[N],C[N];
int a,b,c;
int main(){
    cin>>n;
    for (int i = 0; i < n; i++){
        cin >> m;
        if(m%3==0){
            A[++a] = m;
        }else if(m%3==1){
            B[++b] = m;
        }else{C[++c] = m;}
    }
    if((b>0&&c>0&&a==0)||a-1>b+c){
        cout << "No";
        return 0;
    }cout << "Yes" << endl;
    while(b>=1){
        if(a>=2)cout << A[a--] << " ";
        cout << B[b--] << " ";
    }cout << A[a--] << " ";
    while(c>=1){
        cout << C[c--] << " ";
        if(a>=1)cout << A[a--] << " ";
    }
    return 0 ;
}

#8 WA

the number you output is not equal to the input

2023/12/13 23:08
加载中...