Submission #662208

# Submission time Handle Problem Language Result Execution time Memory
662208 2022-11-26T07:36:31 Z alvingogo Monster Game (JOI21_monster) C++17
0 / 100
74 ms 300 KB
#include <bits/stdc++.h>
#include "monster.h"
#pragma GCC optimize("Ofast")
#define AquA cin.tie(0);ios_base::sync_with_stdio(0);
#define fs first
#define sc second
#define p_q priority_queue
using namespace std;

vector<int> dc(int l,int r){
    if(l==r){
        return vector<int>(1,l);
    }
    int m=(l+r)/2;
    auto a=dc(l,m);
    auto b=dc(m+1,r);
    int i=0,j=0;
    vector<int> c;
    int x=a.size(),y=b.size();
    while(i<=x-1 || j<=y-1){
        if(i>x-1){
            c.push_back(b[j]);
            j++;
        }
        else if(j>y-1){
            c.push_back(a[i]);
            i++;
        }
        else{
            if(!Query(a[i],b[j])){
                c.push_back(a[i]);
                i++;
            }
            else{
                c.push_back(b[j]);
                j++;
            }
        }
    }
    return c;
}
vector<int> se(vector<int> a,int big){
    int n=a.size();
    while(big<n-1){
        for(int i=big+1;i<n;i++){
            if(Query(a[big],a[i])){
                reverse(a.begin()+big+1,a.begin()+i+1);
                big=i;
                break;
            }
        }
    }
    return a;
}
int find0(vector<int>& a){
    int n=12;
    n=min(n,(int)a.size());
    vector<int> cnt(n);
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(Query(a[i],a[j])){
                cnt[i]++;
            }
            else{
                cnt[j]++;
            }
        }
    }
    vector<int> g;
    for(int i=0;i<n;i++){
        if(cnt[i]==1){
            g.push_back(i);
        }
    }
    if(Query(a[g[0]],a[g[1]])){
        return g[0];   
    }
    else{
        return g[1];
    }
}
vector<int> Solve(int N){
    auto h=dc(0,N-1);
    /*
    int x=find0(h);
    reverse(h.begin(),h.begin()+x+1);
    h=se(h,x);
    vector<int> k(N);
    for(int i=0;i<N;i++){
        k[h[i]]=i;
    }
    */
    return h;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 74 ms 300 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -