Submission #1310411

#TimeUsernameProblemLanguageResultExecution timeMemory
1310411cansu_mutluArt Collections (BOI22_art)C++20
0 / 100
1 ms332 KiB
/*
SAMPLE GRADER for task ART

USAGE:
place together with your solution and art.h in the same directory, then open the terminal in this directory
(right-click onto an empty spot in the directory, left click on "Open in terminal") and enter:
    g++ <flags> sample_grader.cpp <solution_file>
e.g.:
    g++ -std=c++17 sample_grader.cpp art.cpp
This will create a file a.out in the current directory which you can execute from the terminal as ./a.out

INPUT/OUTPUT:
The sample grader first expects on standard input two lines. The first line should
contain the integer N. The second line should contain a list of N space-separated
integers, the correct ranking of the collections in the same format as for publish
and answer. Then, the grader calls solve(N) and writes to standard output a protocol
of all grader functions called by your program. Upon termination, it writes your
verdict to standard output.
*/
#include<bits/stdc++.h>
#include "art.h"
//#define int long long 
using namespace std;
void solve(int N) {
    int n = N;
    vector<int> a(n);
    for(int i=0;i<n;i++) a[i] = i+1;
    int cur = publish(a);
    if(cur==(n*(n-1)/2))
    {
        reverse(a.begin(),a.end());
        answer(a);
    }
    for(int j=1;j<=n;j++)
    {
        int l = 0, r = n-1;
        int say = 0;
        int konum = 0;
        if(cur==0) break;
        while(say<30)
        {
             if(cur==0) break;
            say++;
            int mid = l+r;
            mid/=2;
            vector<int> b(n);
            int su = 0;
            for(int i=0;i<n;i++)
            {
                if(i==mid) b[i] = j;
                else
                {
                    if(a[su]==j)su++;
                    b[i] = a[su];
                    su++;
                    
                }
            }
            //cout << mid << " " << j << endl;
            //for(int x:b) cout << x << " ";
            //cout << endl;
            int  now = publish(b);
            if(now<cur)
            {
                cur = now;
                a = b;
                r = mid-1;
            }
            else l = mid+1;
        }
    }
    answer(a);
}
#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...