| Task: | Sukujuhla |
| Sender: | siirikuoppala |
| Submission time: | 2017-02-15 15:02:00 +0200 |
| Language: | C++ |
| Status: | READY |
| Result: | 100 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 19 |
| #2 | ACCEPTED | 32 |
| #3 | ACCEPTED | 49 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.10 s | 1 | details |
| #2 | ACCEPTED | 0.12 s | 2 | details |
| #3 | ACCEPTED | 1.53 s | 3 | details |
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 && c!=j && c!=i) return c;
else if(b!= h && b!=j && b!=i) 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 && b!=i) 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; ++i) t[i]= f2(t[i], t[i+1], 3);
for(int i=2; i<2*k-1; ++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: ACCEPTED
| input |
|---|
| #!/bin/bash set -e OFFSET=$(grep -onam1 '^__DATA_... |
| correct output |
|---|
| 50 |
| user output |
|---|
| B C B ... Truncated |
Test 2
Group: 2
Verdict: ACCEPTED
| input |
|---|
| #!/bin/bash set -e OFFSET=$(grep -onam1 '^__DATA_... |
| correct output |
|---|
| 50 |
| user output |
|---|
| C A C C C ... Truncated |
Test 3
Group: 3
Verdict: ACCEPTED
| input |
|---|
| #!/bin/bash set -e OFFSET=$(grep -onam1 '^__DATA_... |
| correct output |
|---|
| 50 |
| user output |
|---|
| C B C C B ... Truncated |
