This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std ;
#define pb push_back
typedef vector < int > vi ;
#include "coins.h"
vi coin_flips ( vi b , int c ) {
int row = -1 , column = -1 ;
for ( int i = 0 ; i < 8 ; i ++ ) {
for ( int j = 0 ; j < 8 ; j ++ ) {
if ( i * 8 + j == c ) {
row = i ;
column = j ;
break ;
}
}
}
vi flips ;
for ( int i = 0 ; i < 3 ; i ++ ) {
int on = ( ( row & ( 1 << i ) ) > 0 ) ;
if ( b [i] != on ) {
flips .pb ( i ) ;
}
}
for ( int i = 3 ; i < 6 ; i ++ ) {
int on = ( ( column & ( 1 << ( i - 3 ) ) ) > 0 ) ;
if ( b [i] != on ) {
flips .pb ( i ) ;
}
}
if ( flips .size () == 0 ) {
flips .pb ( 0 ) ;
flips .pb ( 0 ) ;
}
return flips ;
}
int find_coin ( vi b ) {
int row = 0 , column = 0 ;
for ( int i = 0 ; i < 3 ; i ++ ) {
if ( b [i] == 1 ) {
row |= ( 1 << i ) ;
}
}
for ( int i = 3 ; i < 6 ; i ++ ) {
if ( b [i] == 1 ) {
column |= ( 1 << ( i - 3 ) ) ;
}
}
return row * 8 + column ;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |