QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#639627#9176. Non-Interactive NimDreamAwakingWA 0ms3596kbC++141.1kb2024-10-13 20:58:072024-10-13 20:58:08

Judging History

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

  • [2024-10-13 20:58:08]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3596kb
  • [2024-10-13 20:58:07]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
 
ll nums[100];

void solve(){
    int n;
    cin>>n;
    vector<ll> v;
    for(int i=1;i<=n;i++){
        ll num;
        cin>>num;
        v.push_back(num);
    }
    int bits[100];
    int loc[100];
    memset(bits,0,sizeof(bits));
    for(int i=0;i<n;i++){
        bitset<64> bit=v[i];
        for(int j=0;j<=62;j++){
            if(bit[j]){
                bits[j]++;
                loc[j]=i+1;
            }
        }
    }
    int flag=1;
    int cnt=0;
    for(int i=0;i<=62;i++){
        cout<<bits[i]<<'\n';
        if(bits[i]>2) flag=0;
        if(bits[i]==2) cnt++;
    }
    if(!flag){
        cout<<"-1"<<'\n';
    }
    else{
        cout<<cnt<<'\n';
        for(int i=62;i>=0;i--){
            if(bits[i]){
                cout<<loc[i]<<" "<<nums[i]<<'\n';
            }
        }
    }
}
 
int main(){
    std::ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int t;
    cin>>t;
    nums[0]=1;
    for(int i=1;i<=62;i++){
        nums[i]=nums[i-1]*2;
    }
    while(t--){
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
4
4 2 7 1
4
1 1 1 1

output:

2
2
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
3 4
3 2
4 1
4
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1

result:

wrong answer Integer parameter [name=p] equals to 0, violates the range [1, 4] (test case 1)