Submission #947574

# Submission time Handle Problem Language Result Execution time Memory
947574 2024-03-16T12:57:13 Z onepunchac168 Monster Game (JOI21_monster) C++17
0 / 100
52 ms 856 KB
#include "monster.h"
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
mt19937  mt(time(nullptr));
bool query(int a,int b)
{
    return Query(a,b);
}
std::vector<int> Solve(int n)
{
    vector <int> opt;
    for (int i=0;i<n;i++)
    {
        if (opt.empty())
        {
            opt.pb(i);
        }
        else
        {
            vector <int> rr;
            int ans=opt.size();
            int left=0;
            int right=opt.size()-1;
            while (left<=right)
            {
                int mid=(left+right)/2;
                if (query(opt[mid],i)==true)
                {
                    ans=mid;
                    right=mid-1;
                }
                else left=mid+1;
            }
            for (int j=0;j<ans;j++)
            {
                rr.pb(opt[j]);
            }
            rr.pb(i);
            for (int j=ans;j<opt.size();j++)
            {
                rr.pb(opt[j]);
            }
            swap(rr,opt);
        }
    }
    vector <int> rr=opt;
    for (int i=rr.size()-1;i>=1;i--)
    {
        if (query(rr[i-1],rr[i])==true)
        {
            swap(rr[i],rr[i-1]);
        }
    }
    return rr;
}

Compilation message

monster.cpp: In function 'std::vector<int> Solve(int)':
monster.cpp:41:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |             for (int j=ans;j<opt.size();j++)
      |                            ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 52 ms 856 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -