답안 #746790

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
746790 2023-05-23T06:05:23 Z Joibangla 화성 (APIO22_mars) C++17
컴파일 오류
0 ms 0 KB
#include<perm.h>
#include<bits/stdio++.h>
using namespace std;
 
typedef long long ll;
 
void normalize(vector<float>& a) {
  vector<float> b = a;
  sort(b.begin(), b.end());
  map<float, int> mp;
  for (int i = 0; i < (int)b.size(); i++) mp[b[i]] = i;
  for (int i = 0; i < (int)a.size(); i++) a[i] = mp[a[i]];
}
 
void insert(vector<float>& a, int x) {
  int n = a.size();
  if (x == 0) {
    a.push_back(n);
    a.push_back(n + 1);
    return;
  } else if (x == 1) {
    a.push_back(n);
    a.push_back(n + 1);
    a.push_back(-1);
    normalize(a);
    return;
  } else if (x == 2) {
    a.push_back(n);
    a.push_back(-1);
    a.push_back(n + 1);
    normalize(a);
    return;
  } else {
    // x = 3
    bool oneThenZero = false;
    for (auto& i : a) {
      if (i == 1) {
        oneThenZero = true;
        break;
      } else if (i == 0) {
        break;
      }
    }
    if (oneThenZero) {
      a.push_back(n);
      a.push_back(n + 1);
      a.push_back(1.5);
      normalize(a);
      return;
    } else {
      a.push_back(n);
      a.push_back(-1);
      a.push_back(n + 1);
      a.push_back(-2);
      normalize(a);
      return;
    }
  }
}
 
vector<int> construct_permutation(ll k) {
  vector<int> a;
  while (k) {
    a.push_back(k % 4);
    k /= 4;
  }
  reverse(a.begin(), a.end());
  vector<float> ans;
  switch (a[0]) {
    case 1:
      break;
    case 2:
      ans.push_back(0);
      break;
    case 3:
      ans.push_back(1);
      ans.push_back(0);
      break;
  }
  for (int i = 1; i < (int)a.size(); i++) {
    insert(ans, a[i]);
  }
  vector<int> res(ans.begin(), ans.end());
  return res;
}

Compilation message

mars.cpp:1:9: fatal error: perm.h: No such file or directory
    1 | #include<perm.h>
      |         ^~~~~~~~
compilation terminated.