QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#117072 | #6667. Prosjek | eyiigjkn# | 0 | 699ms | 6820kb | C++14 | 1.2kb | 2023-06-30 12:49:06 | 2024-05-31 18:40:33 |
Judging History
answer
# include <bits/stdc++.h>
using namespace std;
using ll=long long;
int que[70];
bool vis[70];
ll a[1000010];
vector<ll> vec[70];
vector<pair<ll,ll>> ans;
ll work(ll x,ll y)
{
cerr<<"work("<<x<<" , "<<y<<")\n";
ans.emplace_back(x,y);
return (x+y)/2;
}
int main()
{
ios::sync_with_stdio(false);cin.tie(nullptr);
int T,n;ll x;
cin>>T;
while(T--)
{
int l=1,r=1;
cin>>n;
for(int i=1;i<=n;i++) cin>>x,vec[__lg(x&-x)].push_back(x);
for(int i=0;i<60;i++)
if(vec[i].size()>1) vis[que[r++]=i]=1;
while(l<r)
{
int k=que[l++];
vis[k]=0;
ll x=vec[k].back();vec[k].pop_back();
ll y=vec[k].back();vec[k].pop_back();
x=work(x,y);
vec[k=__lg(x&-x)].push_back(x);
if(!vis[k] && vec[k].size()>1) vis[que[r++]=k]=1;
}
int tot=0;
static ll b[70];
for(int i=1;i<60;i++)
if(!vec[i].empty()) b[++tot]=vec[i].front();
for(int i=tot-1;i>=1;i--) b[i]=work(b[i],b[i+1]);
if(tot && !vec[0].empty())
{
if(b[1]&1) work(b[1],vec[0].front());
else ans.clear();
}
if(ans.empty()) cout<<"-1\n";
else for(auto &i:ans) cout<<i.first<<" "<<i.second<<"\n";
fill(vis,vis+60,0);
for(int i=0;i<60;i++) vec[i].clear();
ans.clear();
}
return 0;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3600kb
input:
99 4 739880851158065302 19206582949872932 883064254701115295 222072661880779376 7 148399819461615003 209088712310207988 53191076581680214 445068618251612752 230505279594622109 115754892157516718 804173775829453588 2 77979357045500669 41693388829622019 3 341612949433488278 609808714829036935 19994167...
output:
-1 230505279594622109 148399819461615003 115754892157516718 53191076581680214 189452549528118556 804173775829453588 496813162678786072 445068618251612752 209088712310207988 470940890465199412 84472984369598466 340014801387703700 41693388829622019 77979357045500669 341612949433488278 1999416745065738...
result:
wrong answer you didn't find a solution but jury did (test case 1)
Subtask #2:
score: 0
Runtime Error
Test #16:
score: 0
Runtime Error
input:
100 3 3 3 2 3 4 1 1 4 1 3 4 4 6 4 4 2 3 1 2 4 0 2 1 4 3 0 2 0 7 3 3 1 1 3 4 0 2 0 4 4 1 4 2 3 7 4 0 0 3 2 3 4 4 4 2 0 3 7 0 2 2 1 4 2 4 7 3 0 3 1 2 0 3 4 4 3 1 4 6 2 3 0 1 3 4 5 1 4 0 3 4 5 4 2 0 4 2 3 0 1 2 6 4 1 4 2 0 4 7 4 2 4 3 1 3 1 4 1 4 4 0 2 1 1 6 0 3 3 0 0 4 7 4 3 0 3 3 3 4 4 4 1 1 3 6 2 0 ...
output:
-1 -1 3 1 4 4 2 4 1 3 2 2 4 4 2 2 2 4
result:
Subtask #3:
score: 0
Wrong Answer
Test #34:
score: 0
Wrong Answer
time: 699ms
memory: 3580kb
input:
100000 5 846784256447769304 457696478728961702 128469521648960690 597630796847754190 104256763714529164 5 658897822238868978 472135077337628566 399538027669313322 622703684108675696 425723088635325654 5 917704960887390986 140817562615382054 877934664521057998 782212806618666818 616380973421914538 8 ...
output:
597630796847754190 128469521648960690 846784256447769304 363050159248357440 104256763714529164 604917207848063372 457696478728961702 354586985781296268 425723088635325654 399538027669313322 622703684108675696 412630558152319488 658897822238868978 517667121130497592 616380973421914538 782212806618666...
result:
wrong answer there's no 616380973421914538 in the current set (test case 2)
Subtask #4:
score: 0
Wrong Answer
Test #46:
score: 0
Wrong Answer
time: 95ms
memory: 6820kb
input:
100 211957 911918942087402387 344230223346742784 16289402153237664 528890583619159010 886281719684850237 865484734102017297 321851390502278959 754268375474197153 237414161302130571 135637002716682378 824412491959977735 162505521049217610 246319278060116103 666703181591704279 650875500699154233 96397...
output:
-1 -1 -1 652443611450615643 362894613334323417 507669112392469530 142023294003738082 648678366985632556 622805962943947164 641743429428882296 648330264264910456 264346837031611728 926859064657931504 595602950844771616 336292110810134944 748836615793342912 64795285149155136 406815950471249024 4618634...
result:
wrong answer you didn't find a solution but jury did (test case 1)