QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#304782#8004. Bit Componentucup-team992#WA 1ms3596kbC++17841b2024-01-14 02:56:142024-01-14 02:56:16

Judging History

你现在查看的是最新测评结果

  • [2024-01-14 02:56:16]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3596kb
  • [2024-01-14 02:56:14]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

typedef int uci;
#define int long long
#define F first
#define S second
#define ar array

void solve(){
    int n;
    cin >> n;
    int val = -1;
    for(int i{1}; i < 20; ++i){
        if((1<<i)-1 == n){
            val = i;
        }
    }
    if(val == -1){
        cout << "No\n";
        return;
    }

    vector<int> v;
    v.push_back(1);
    for(int i{2}; i <= val; ++i){
        vector<int> ne;
        ne.push_back(1<<(i-1));
        for(int j = v.size()-1; j >= 0; --j){
            ne.push_back((1<<(i-1)) | v[j]);
        }
        for(int i : v)
            ne.push_back(i);
        v.swap(ne);
    }
    cout << "Yes\n";
    for(int i : v)
        cout << i << ' ';
    cout << '\n';
}

uci main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3596kb

input:

1

output:

Yes
1 

result:

wrong output format YES or NO expected in answer, but Yes found