Submission #839564

#TimeUsernameProblemLanguageResultExecution timeMemory
839564model_codeCoreputer (IOI23_coreputer)C++17
60 / 100
1 ms332 KiB
// partially_correct/sol_db_2N.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) { vector <int> pre; int resp = 0; for (int i = 0; i < N; ++i) { pre.push_back(i); resp = ask(pre, N); if (resp >= 0) { break; } } 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...