Submission #685200

#TimeUsernameProblemLanguageResultExecution timeMemory
685200heeheeheehaawMouse (info1cup19_mouse)C++17
0 / 100
1 ms208 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; void solve(int n) { vector<int> q, poz, rez; for(int i = 1; i <= n; i++) { q.push_back(i); poz.push_back(0); rez.push_back(0); } int a = query(q); while(a > 0 && a < n) { random_shuffle(q.begin(), q.end()); a = query(q); } if(a == n) return; for(int i = 0; i < q.size(); i++) poz[q[i]] = i; for(int i = 1; i <= n; i++) { if(rez[i - 1] != 0) continue; for(int j = 0; j < n; j++) { if(poz[i] != j) swap(q[j], q[poz[i]]); a = query(q); if(a >= 1) rez[j] = i; if(a == 2) rez[poz[i]] = q[poz[i]]; if(poz[i] != j) swap(q[j], q[poz[i]]); } } query(rez); }

Compilation message (stderr)

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