Submission #1076069

# Submission time Handle Problem Language Result Execution time Memory
1076069 2024-08-26T10:56:15 Z matthew Mouse (info1cup19_mouse) C++17
0 / 100
0 ms 344 KB
#include "grader.h"
#include <vector>
#include <stdio.h>

/*
int perm[10000];

int query(std::vector<int> v) {
  int i, res;

  res = 0;
  for(i = 1; i < (int)v.size(); i++) {
    res += v[i] == perm[i - 1];
  }
  return res;
}
*/

void solve(int n) {
  int val, l, r, mij, i, ans;

  std::vector<int> v;
  std::vector<int> res;
  for(i = 0; i <= n; i++) {
    res.push_back(0);
  }
  for(val = 1; val <= n; val++) {
    l = 0;
    r = n - 1;
    while(l < r) {
      mij = (l + r) / 2;

      v.clear();
      v.push_back(0);
      for(i = 1; i <= n; i++) {
        v.push_back(n + 1);
      }
      for(i = l; i <= mij; i++) {
        v[i + 1] = val;
      }

      ans = query(v);
      if(ans == 0) {
        l = mij + 1;
      } else {
        r = mij;
      }
    }
    res[l + 1] = val;
  }

  query(res);
}

/*
int main() {
  int n, i;

  scanf("%d", &n);
  for(i = 0; i < n; i++) {
    scanf("%d", &perm[i]);
  }

  solve(n);

  return 0;
}
*/
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -