Submission #685200

# Submission time Handle Problem Language Result Execution time Memory
685200 2023-01-23T16:56:30 Z heeheeheehaaw Mouse (info1cup19_mouse) C++17
0 / 100
1 ms 208 KB
#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

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 time Memory Grader output
1 Incorrect 1 ms 208 KB Integer 0 violates the range [1, 7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Integer 0 violates the range [1, 7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Integer 0 violates the range [1, 7]
2 Halted 0 ms 0 KB -