| Task: | Sukujuhla |
| Sender: | ollpu |
| Submission time: | 2017-01-19 17:03:53 +0200 |
| Language: | C++ |
| Status: | READY |
| Result: | 19 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 19 |
| #2 | WRONG ANSWER | 0 |
| #3 | WRONG ANSWER | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.10 s | 1 | details |
| #2 | WRONG ANSWER | 0.11 s | 2 | details |
| #3 | WRONG ANSWER | 1.27 s | 3 | details |
Code
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, m, k;
cin >> n >> m >> k;
if (m == 1) {
int pos1 = 15;
for (int i = 0; i < 15; ++i) {
int v;
cin >> v;
if (v == 1) {
pos1 = i;
}
}
cout << (pos1%2 ? 'A' : 'B') << endl;
} else if (m == 10) {
int t[15];
for (int i = 0; i < 15; ++i) {
cin >> t[i];
}
int hi[3], hv[3] = {0,0,0};
for (int i = 0; i < 15; ++i) {
if (t[i] > hv[0]) hv[0] = t[i], hi[0] = i;
}
for (int i = 0; i < 15; ++i) {
if (abs(i-hi[0]) <= 1) continue;
if (t[i] > hv[1]) hv[1] = t[i], hi[1] = i;
}
for (int i = 0; i < 15; ++i) {
if (abs(i-hi[0]) <= 1 || abs(i-hi[1]) <= 1) continue;
if (t[i] > hv[2]) hv[2] = t[i], hi[2] = i;
}
char res[15];
int det[15];
for (int i = 0; i < 15; ++i) {
det[i] = 0;
}
det[hi[0]] = 1;
det[hi[1]] = 1;
det[hi[2]] = 1;
res[hi[0]] = 'A';
res[hi[1]] = 'A';
res[hi[2]] = 'A';
sort(hi, hi+3);
for (int i = hi[0]+1; i < 15; ++i) {
if (i < 14 && det[i+1]) {
if (res[i-1] != 'A' && res[i+1] != 'A') {
res[i] = 'A';
det[i] = 1;
} else if (res[i-1] != 'B' && res[i+1] != 'B') {
res[i] = 'B';
det[i] = 1;
} else {
res[i] = 'C';
det[i] = 1;
}
} else {
if (res[i-1] != 'A') {
res[i] = 'A';
det[i] = 1;
} else if (res[i-1] != 'B') {
res[i] = 'B';
det[i] = 1;
} else {
res[i] = 'C';
det[i] = 1;
}
}
}
for (int i = hi[0]-1; i >= 0; --i) {
if (res[i+1] != 'A') {
res[i] = 'A';
} else if (res[i+1] != 'B') {
res[i] = 'B';
}
}
cout << res[7] << endl;
} else {
}
}
Test details
Test 1
Group: 1
Verdict: ACCEPTED
| input |
|---|
| #!/bin/bash set -e OFFSET=$(grep -onam1 '^__DATA_... |
| correct output |
|---|
| 50 |
| user output |
|---|
| A B A ... Truncated |
Test 2
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| #!/bin/bash set -e OFFSET=$(grep -onam1 '^__DATA_... |
| correct output |
|---|
| 50 |
| user output |
|---|
| B B B ... Truncated |
Test 3
Group: 3
Verdict: WRONG ANSWER
| input |
|---|
| #!/bin/bash set -e OFFSET=$(grep -onam1 '^__DATA_... |
| correct output |
|---|
| 50 |
| user output |
|---|
... |
