Submission #1015023

#TimeUsernameProblemLanguageResultExecution timeMemory
1015023hmm789Mouse (info1cup19_mouse)C++14
0 / 100
1 ms344 KiB
#include "grader.h" #include <bits/stdc++.h> using namespace std; void solve(int n) { vector<int> v, ans; for(int i = 0; i < n; i++) { v.push_back(2); ans.push_back(-1); } for(int i = 0; i < n; i++) { v[i] = 1; if(query(v) == 2) ans[i] = 1; v[i] = 2; } for(int i = 2; i < n; i++) { vector<int> pos; for(int j = 0; j < n; j++) { if(ans[j] == -1) pos.push_back(j); v[j] = ans[j]; } int l = 0, r = pos.size()-1, m; while(l < r) { m = (l+r)/2; for(int j = 0; j <= m; j++) v[pos[j]] = i; for(int j = m+1; j < pos.size(); j++) v[pos[j]] = 1; if(query(v) == i) r = m; else l = m+1; } ans[pos[l]] = i; } for(int i = 0; i < n; i++) if(ans[i] == -1) ans[i] = n; query(ans); }

Compilation message (stderr)

mouse.cpp: In function 'void solve(int)':
mouse.cpp:26:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |             for(int j = m+1; j < pos.size(); j++) v[pos[j]] = 1;
      |                              ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...