Submission #29371

# Submission time Handle Problem Language Result Execution time Memory
29371 2017-07-19T07:45:48 Z Bruteforceman cmp (balkan11_cmp) C++11
91 / 100
4476 ms 82552 KB
#include "cmp.h"
#include "bits/stdc++.h"

void remember(int n) {
  //edit this
  std::vector <int> v;
  for(int i = 0; i < 4; i++) {
  	v.push_back(n % 8);
  	n /= 8;
  }
  reverse(v.begin(), v.end());
  for(size_t i = 0; i < v.size(); i++) {
  	bit_set(v[i] + i * 8 + 1);
  }
}
int compare(int b) {
  //edit this
  std::vector <int> v;
  for(int i = 0; i < 4; i++) {
  	v.push_back(b % 8);
  	b /= 8;
  }
  reverse(v.begin(), v.end());
  for(size_t i = 0; i < v.size(); i++) {
  	if(bit_get(v[i] + i * 8 + 1) == 0) {
  		if(v[i] <= 3) {
  			for(int j = 0; j < v[i]; j++) {
  				if(bit_get(j + i * 8 + 1) == 1) return 1;
  			}
  			return -1;
  		} else {
  			for(int j = v[i] + 1; j < 8; j++) {
  				if(bit_get(j + i * 8 + 1) == 1) return -1;
  			}
  			return 1;
  		}
  	}
  }
  return 0;
}
# Verdict Execution time Memory Grader output
1 Partially correct 4476 ms 82552 KB Output is partially correct - maxAccess = 11, score = 91