Submission #839556

#TimeUsernameProblemLanguageResultExecution timeMemory
839556model_codeCoreputer (IOI23_coreputer)C++17
80 / 100
1 ms288 KiB
// partially_correct/sol_db_N+logN.cpp #include <bits/stdc++.h> #include "coreputer.h" using namespace std; int ask(vector <int> q, int N) { if (q.size() >= N) { return 1; } else if (q.empty()) { return -1; } else { return run_diagnostic(q); } } vector <int> malfunctioning_cores(int N) { int resp = 0, p = 0; vector <int> pre; for (int i = 4; i >= 0; --i) { int r = p + (1 << i); pre.clear(); for (int j = 0; j < r; ++j) { pre.push_back(j); } int res = ask(pre, N); if (res < 0) { p = r; } else { resp = res; } } p++; pre.clear(); for (int i = 0; i < p; ++i) { pre.push_back(i); } vector <int> ans(N, 0); for (int i = 0; i < N; ++i) { vector <int> simdiff = pre; auto it = find(simdiff.begin(), simdiff.end(), i); if (it != simdiff.end()) { simdiff.erase(it); ans[i] = ask(simdiff, N) != resp; } else { simdiff.pop_back(); simdiff.push_back(i); ans[i] = ask(simdiff, N) == resp; } } return ans; }

Compilation message (stderr)

coreputer.cpp: In function 'int ask(std::vector<int>, int)':
coreputer.cpp:8:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
    8 |     if (q.size() >= N) {
      |         ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...