CSES - Datatähti 2017 loppu - Results
Submission details
Task:Sukujuhla
Sender:siirikuoppala
Submission time:2017-02-15 14:48:59 +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>
#include <vector>
using namespace std;
typedef long long ll;

int n, m, k;
int f1(int x, int y, int k){
  int c = x^y;
  for(int i=31; i>=0; --i){
    int b = (1<<i);
    if(c&b) {
      if(x&b) return i;
      else return k+i;
    }
  }
  return 0;
}
int f2(int x, int y, int k){
  int a=0, b=0, c=0;
  if(k==3){
    int z=0;
    for(int i=0; i<2*k; ++i){
      for(int j=i+1; j<2*k; ++j){
        for(int h=j+1; h<2*k; ++h){
          if(z==x) a=i, b=j, c=h;
          ++z;
        }
      }
    }
    z=0;
    for(int i=0; i<2*k; ++i){
      for(int j=i+1; j<2*k; ++j){
        for(int h=j+1; h<2*k; ++h){
          if(z==y){
            if(c != h) return c;
            else if(b!=j) return b;
            else return a;
          }
          ++z;
        }
      }
    }
  }
  else{
    int z=0;
    for(int i=0; i<2*k; ++i){
      for(int j=i+1; j<2*k; ++j){
        if(z==x) a=i, b=j;
        ++z;
      }
    }
    z=0;
    for(int i=0; i<2*k; ++i){
      for(int j=i+1; j<2*k; ++j){
        if(z==y){
          if(b!=j) return b;
          else return a;
        }
        ++z;
      }
    }
  }
  return 0;
}

int t[16];
int main(){
  int n, m, k;
  cin >> n >> m >> k;
  for(int i=0; i<m; ++i){
    for(int i=0; i<2*k+1; ++i){
      cin >> t[i];
    }
    for(int i=2*k; i>0; --i) t[i]= f1(t[i], t[i-1], 32);
    for(int i=2*k; i>1; --i) t[i]= f1(t[i], t[i-1], 6);
    for(int i=2; i<2*k-1; ++i) t[i]= f2(t[i], t[i+1], 3);
    for(int i=2; i<2*k-2; ++i) t[i]= f2(t[i], t[i+1], 2);
    if(t[k] == 0) cout << "A\n";
    else if(t[k]== 1) cout << "B\n";
    else if(t[k]==2) cout << "C\n";
    else{
      if(t[k-1] != 1 && t[k+1] != 1) cout << "B\n";
      else if (t[k-1] != 2 && t[k+1] != 2) cout << "C\n";
      else cout << "A\n";
    }
  }
}

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)