QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#337434#8004. Bit Componentucup-team1209#WA 0ms3840kbC++201.7kb2024-02-25 11:55:442024-02-25 11:55:45

Judging History

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

  • [2024-02-25 11:55:45]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3840kb
  • [2024-02-25 11:55:44]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define drep(i,y,x) for (int i=(y);i>=(x);i--)
#define pii pair<int,int>
#define fir first
#define sec second
#define MP make_pair
#define templ template<typename T>
templ bool chkmin(T &x,T y){return x>y?x=y,1:0;}
templ bool chkmax(T &x,T y){return x<y?x=y,1:0;}
void file() {
    #ifdef zqj
    freopen("a.in","r",stdin);
    #endif
}
typedef long long ll;

// int fa[1000000];
// int fnd(int x) {return x == fa[x] ? x : fa[x] = fnd(fa[x]); }

int main() {
    file();
    ios::sync_with_stdio(false),cin.tie(0);
    int n; cin>>n;
    int _n=n+1;
    while (!(_n&1)) _n>>=1;
    if (_n!=1) return cout<<"NO\n",0;
    int m=2;
    vector<int>V; V.push_back(0),V.push_back(1);
    while (m<n) {
        vector<int>v=V;
        reverse(v.begin(),v.end());
        for (auto &x:V) x*=2;
        for (auto x:v) V.push_back(x*2+1);
        m<<=1;
    }
    // vector <pii> t; 
    // int x = __lg(n) + 1;
    // for(int i = 0; i < n; i++)
    // for(int j = 0; j < x; j++) if(V[i] >> j & 1) 
    // t.push_back({i, j});
    // for(int i= 0; i < t.size(); i++) fa[i] = i; 
    // for(int i = 0; i < t.size(); i++) {
    //     auto [x, y] = t[i];
    //     for(int j = i + 1; j < t.size(); j++) {
    //         auto [u, v] = t[j];
    //         if(abs(u - x) + abs(v - y) <= 1) {
    //             fa[fnd(i)] = fnd(j);
    //         }
    //     }
    // }
    // int cnt = 0; 
    // for(int i = 0; i < t.size(); i++) if(i == fnd(i)) ++ cnt; 
    // assert(cnt == 1);
    cout<<"YES\n";
    rep(i,1,n) cout<<V[i]<<" \n"[i==n];
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3620kb

input:

1

output:

YES
1

result:

ok answer is 1

Test #2:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

2

output:

NO

result:

ok answer is 0

Test #3:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

3

output:

YES
2 3 1

result:

ok answer is 1

Test #4:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

4

output:

NO

result:

ok answer is 0

Test #5:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

5

output:

NO

result:

ok answer is 0

Test #6:

score: 0
Accepted
time: 0ms
memory: 3536kb

input:

6

output:

NO

result:

ok answer is 0

Test #7:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

7

output:

YES
4 6 2 3 7 5 1

result:

ok answer is 1

Test #8:

score: 0
Accepted
time: 0ms
memory: 3536kb

input:

8

output:

NO

result:

ok answer is 0

Test #9:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

9

output:

NO

result:

ok answer is 0

Test #10:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

10

output:

NO

result:

ok answer is 0

Test #11:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

11

output:

NO

result:

ok answer is 0

Test #12:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

12

output:

NO

result:

ok answer is 0

Test #13:

score: -100
Wrong Answer
time: 0ms
memory: 3708kb

input:

13

output:

NO

result:

wrong answer Jury has the answer, participant doesn't