QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#522756#9176. Non-Interactive Nimhhu_yjhWA 0ms3740kbC++171.4kb2024-08-17 13:15:092024-08-17 13:15:09

Judging History

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

  • [2024-08-17 13:15:09]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3740kb
  • [2024-08-17 13:15:09]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int N=2e6+10;
const int mod=998244353;
typedef long long ll;
//typedef unsigned long long ull;
typedef pair<ll,ll> PII;
ll n,k;
ll a[N];
void solve(){
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    cout<<-1<<endl;
    exit(0);
    vector<set<int>> cnt(70);
    for(int i=1;i<=n;i++){
        for(int j=0;j<=62;j++){
            if(a[i]>>j&1) cnt[j].insert(i);
        }
    }
    vector<pair<ll,ll>> ans;
    auto work=[&](ll x,ll y){
        ll temp=0;
        for(int k=62;k>=0;k--){
            if((a[x]>>k&1)&&(a[y]>>k&1)){
                cnt[k].erase(x),cnt[k].erase(y);
                a[x]-=1ll<<k,a[y]-=1ll<<k;
                temp+=1ll<<k;
            }
        }
        ans.push_back({x,temp});
    };
    for(int i=62;i>=0;i--){
        if(cnt[i].size()==0) continue;
        if(cnt[i].size()!=2){
            cout<<-1<<endl;
            return;
        }
        ll x=*cnt[i].begin();
        cnt[i].erase(x);
        ll y=*cnt[i].begin();
        cnt[i].clear();
        work(x,y);
    }
    cout<<ans.size()<<endl;
    for(auto j:ans){
        cout<<j.first<<' '<<j.second<<endl;
    }

}
int main(){
    
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t;
    cin>>t;
  //	  t=1;
    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: 3740kb

input:

2
4
4 2 7 1
4
1 1 1 1

output:

-1

result:

wrong answer judge has answer but participant doesn't (test case 1)