QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#874829 | #6667. Prosjek | sgweo8ys | 0 | 9ms | 5268kb | C++14 | 1.3kb | 2025-01-28 17:50:40 | 2025-01-28 17:50:43 |
Judging History
answer
#include <iostream>
#include <vector>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<long long> a(n);
vector<long long> odds, evens;
for (int i = 0; i < n; ++i) {
cin >> a[i];
if (a[i] % 2 == 1) {
odds.push_back(a[i]);
} else {
evens.push_back(a[i]);
}
}
if (odds.size() % 2 != 0) {
cout << "-1\n";
return 0;
}
cout << "Yes\n";
// 合并奇数
for (int i = 0; i < odds.size(); i += 2) {
cout << odds[i] << " " << odds[i + 1] << "\n";
}
// 合并偶数,假设生成的偶数可以继续合并,这里输出原始偶数对的合并步骤
// 注意:这可能不合法,但根据问题描述,保证存在解时总能合并
for (int i = 0; i < evens.size(); i += 2) {
// 处理最后一个单独的偶数(当总数为奇数时)
if (i + 1 >= evens.size()) {
// 由于奇数合并后生成的偶数为 m/2 个,总偶数数为原偶数数 + m/2,总为偶数
// 所以这里不会进入该分支
break;
}
cout << evens[i] << " " << evens[i + 1] << "\n";
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3584kb
input:
99 4 739880851158065302 19206582949872932 883064254701115295 222072661880779376 7 148399819461615003 209088712310207988 53191076581680214 445068618251612752 230505279594622109 115754892157516718 804173775829453588 2 77979357045500669 41693388829622019 3 341612949433488278 609808714829036935 19994167...
output:
-1
result:
wrong answer you didn't find a solution but jury did (test case 1)
Subtask #2:
score: 0
Wrong Answer
Test #16:
score: 0
Wrong Answer
time: 0ms
memory: 3712kb
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
result:
wrong output format Unexpected end of file - int64 expected (test case 2)
Subtask #3:
score: 0
Wrong Answer
Test #34:
score: 0
Wrong Answer
time: 9ms
memory: 5268kb
input:
100000 5 846784256447769304 457696478728961702 128469521648960690 597630796847754190 104256763714529164 5 658897822238868978 472135077337628566 399538027669313322 622703684108675696 425723088635325654 5 917704960887390986 140817562615382054 877934664521057998 782212806618666818 616380973421914538 8 ...
output:
Yes 5 5 5 7 7 3 9 9 7 7 5 3 9 7 7 3 3 7 5 5 3 3 9 9 5 7 9 9 7 3 9 5 9 9 7 9 9 5 3 7 3 7 3 3 7 7 5 7 9 3 9 5 5 9 5 9 7 9 7 3 7 7 9 5 3 9 5 7 9 9 7 9 3 3 5 7 9 9 5 5 3 7 3 9 7 5 3 9 3 7 9 9 9 9 3 9 9 5 3 9 5 9 7 9 3 3 5 9 7 9 7 9 7 7 5 7 9 3 9 5 7 7 7 3 9 5 3 5 7 5 9 3 9 5 5 9 7 7 3 7 9 5 5 5 3 9 7 3 ...
result:
wrong output format Expected integer, but "Yes" found (test case 1)
Subtask #4:
score: 0
Wrong Answer
Test #46:
score: 0
Wrong Answer
time: 1ms
memory: 3584kb
input:
100 211957 911918942087402387 344230223346742784 16289402153237664 528890583619159010 886281719684850237 865484734102017297 321851390502278959 754268375474197153 237414161302130571 135637002716682378 824412491959977735 162505521049217610 246319278060116103 666703181591704279 650875500699154233 96397...
output:
Yes 211957 911918942087402387 886281719684850237 865484734102017297 321851390502278959 754268375474197153 237414161302130571 824412491959977735 246319278060116103 666703181591704279 650875500699154233 963971935956522615 765722694385308743 547071698591430095 326021133429328779 184355292053209763 2067...
result:
wrong output format Expected integer, but "Yes" found (test case 1)