Submission #1295490

#TimeUsernameProblemLanguageResultExecution timeMemory
1295490hihihihawArt Collections (BOI22_art)C++20
100 / 100
675 ms476 KiB
#include "art.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
//
// --- Sample implementation for the task art ---
//
// To compile this program with the sample grader, place:
//     art.h art_sample.cpp sample_grader.cpp
// in a single folder, then open the terminal in this directory (right-click onto an empty spot in the directory,
// left click on "Open in terminal") and enter e.g.:
//     g++ -std=c++17 art_sample.cpp sample_grader.cpp
// in this folder. This will create a file a.out in the current directory which you can execute from the terminal
// as ./a.out
// See task statement or sample_grader.cpp for the input specification
//
void solve(int N) {
    int z[N];
    for (int i=0;i<N;i++){
        vector<int> v;
        for (int j=0;j<N-i;j++){
            v.pb(j+i+1);
        }
        for (int j=i;j>0;j--){
            v.pb(j);
        }
        z[i]=publish(v);

    }
    vector<int> ans(N);
    for (int i=1;i<=N;i++){
        int k;
        if (i==N) k=0;
        else k=((z[i]-z[i-1])+(N-i))/2;
        //cout<<k<<endl;
        int c=0;
        for (int j=N-1;j>=0;j--){
            if (ans[j]==0) c++;

            if(c>k){
                ans[j]=i;
                break;
            }
        }
    }
    answer(ans);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...