F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Find Numbers

Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 434    Accepted Submission(s): 158
Special Judge


Problem Description
给n个非负整数,满足对于某正整数k,n=2^k-1。从中选出(n+1)/2个数,使得它们的和是(n+1)/2的倍数。
 

Input
第一行,T,询问个数。
下面2T行,每两行是一个询问。对于每两行:
第一行,n。
第二行,n个整数,a_0, a_1, ..., a_{n-1}。

数据范围:
1<=T<=20
1<=n<=2^15
0<=a_i<=10^9
 

Output
对第i个(1<=i<=T)询问的回答为两行,第一行为编号:
Case #i:
第二行为结果:
如果不能选出这样的(n+1)/2个数,输出-1;
否则输出一行,用一个空格分隔的(n+1)/2个数b_0, b_1, ..., b_{(n+1)/2-1}。满足0<=b_i<n, b_i两两不同,且sum(a_{b_i})是(n+1)/2的倍数。如果有多解,输出任意一个。
 

Sample Input
2 3 1 3 5 7 0 1 2 3 4 5 6
 

Sample Output
Case #1: 0 2 Case #2: 0 2 4 6
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 13:14:38, Gzip enabled