CSES - Datatähti 2017 loppu - Results
Submission details
Task:Sukujuhla
Sender:ollpu
Submission time:2017-01-19 17:03:53 +0200
Language:C++
Status:READY
Result:19
Feedback
groupverdictscore
#1UNKNOWN0
#2UNKNOWN0
#3UNKNOWN0
Test results
testverdicttimegroup
#1UNKNOWN--1details
#2UNKNOWN--2details
#3UNKNOWN--3details

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: UNKNOWN

input
#!/bin/bash
set -e
OFFSET=$(grep -onam1 '^__DATA_...

correct output
50

user output
(not available)

Test 2

Group: 2

Verdict: UNKNOWN

input
#!/bin/bash
set -e
OFFSET=$(grep -onam1 '^__DATA_...

correct output
50

user output
(not available)

Test 3

Group: 3

Verdict: UNKNOWN

input
#!/bin/bash
set -e
OFFSET=$(grep -onam1 '^__DATA_...

correct output
50

user output
(not available)