Submission #947635

# Submission time Handle Problem Language Result Execution time Memory
947635 2024-03-16T17:05:36 Z onepunchac168 Monster Game (JOI21_monster) C++17
0 / 100
51 ms 600 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=1;i<rr.size();i++)
    {
        if (query(rr[i-1],rr[i])==false)
        {
            swap(rr[i],rr[i-1]);
        }
    }
    reverse(rr.begin(),rr.end());
    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++)
      |                            ~^~~~~~~~~~~
monster.cpp:49:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |     for (int i=1;i<rr.size();i++)
      |                  ~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 596 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 596 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 51 ms 600 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -