제출 #1113636

#제출 시각아이디문제언어결과실행 시간메모리
1113636m_bezrutchka동굴 (IOI13_cave)C++14
0 / 100
2053 ms660 KiB
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
void exploreCave(int n) {
  set<int> DONTTOUCH;
  vector<pair<int, int>> setted;
  int comp[n];
  for(int i = 0; i < n; i++){
    comp[i] = 0;
  }
  for(int k = 1; k <= n; k++){
    int newguy = 0;
    for(int i = 0; i < n; i++){
      comp[i] = 0;
    }
    for(auto e : setted){
      int idx = e.first;
      int pos = e.second;
      comp[idx] = pos;
    }
    //to vendo a kesima porta
    int fst = tryCombination(comp);
    for(int j = 13; j >= 0; j--){
      for(int i = 0; i < n; i++){
        if(!DONTTOUCH.count(i)){
          if(i & (1 << j)){
            comp[i] = 1;
          } else {
            comp[i] = 0;
          }
        }
      }
      int nd = tryCombination(comp);
      if(((fst <= k) and (nd <= k)) or ((fst > k) and (nd > k))){
        newguy *= 2;
      } else {
        newguy *= 2;
        newguy++;
      }
    }

    DONTTOUCH.insert(newguy);

    if(fst <= k){
      setted.push_back({newguy, 1});
    } else {
      setted.push_back({newguy, 0});
    }

  }
  int a[n], b[n];
  for(int i = 0; i < n; i++){
    int idx = setted[i].first;
    int pos = setted[i].second;
    a[i] = idx;
    b[i] = pos;
  }
  answer(a, b);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...