Submission #128141

# Submission time Handle Problem Language Result Execution time Memory
128141 2019-07-10T13:02:07 Z OptxPrime Minerals (JOI19_minerals) C++14
0 / 100
31 ms 10360 KB
#include <iostream>
#include <cmath>
#include<vector>
#include <algorithm>
#include <utility>
#include<stack>
#include<queue>
#include<map>
#include <fstream>
#include <minerals.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long

#define ans Answer
#define query Query


    bool inside[100010];
    int nn;
    int curr,opencurr,tmp;

    /*void Answer( int a, int b )
    {
        cout <<a << " " << b<< " par " <<endl;
    }
    int Query( int x )
    {
        cout<<x << " kveri "  << tmp <<endl;
        int t;
        cin>>t;
        return t;
    }*/

    void conquer( vector<int> vec )
    {
        cout << " ponovo " <<endl;
        int sz = vec.size();
        if( sz==2 ){
            ans( vec[0], vec[1] );
            return;
        }
      //  cout << " ciscenje " <<endl;
        for( int i=1;i<=2*nn;i++ ){
            if( inside[i] ) {
                    query( i ); /// ocistimo prethodno, sporo ciscenje samo za probu
                inside[i]=false;
            }
        }
    //    cout << " gotovo ciscenje " <<endl;
        int gsz=sz/2;
        if( gsz%2==1 ) gsz++;
        int opensz = gsz/2;
        vector<int>vec1,vec2;
        vec1.clear();
        vec2.clear();
         curr=0,opencurr=0;
        for( int i=0;i<sz;i++ ){
             tmp = query( vec[i] );
            inside[ vec[i] ] = true;
            if( tmp > curr ){   /// znaci zatvorilo se
             //   if( vec1.size() <gsz ) vec1.pb( vec[i] );   ///zatvorilo se iz prve grupe
             //   else vec2.pb( vec[i] );
             vec1.pb( vec[i] ); /// jedino se moze zatvoriti iz prve grupe jer drugu smo izbacivali iz querija
             curr=tmp;
            // curr=tmp;
            }
        else{   /// otvorio se novi, ili se otvorio/zatvorio ali iz drugog djela
            if( opencurr < opensz  )  { /// ako jos nismo u drugom djelu, prosiri prvi dio
                vec1.pb( vec[i] );
                opencurr++;
                curr=tmp;
            }
            else{   /// ako jesmo, to znaci zatvara se neki iz drugog djela,  ili se otvara u drugom djelu, kako god ide u vec2 i izbacimo ga iz kverija
                vec2.pb( vec[i] );
               curr= query( vec[i] ); /// moramo ga izbaciti
               inside[ vec[i] ] = false;    /// oznaceno da je izbacen
            }
        }
       // curr=tmp;
        }
        /// zaboravio sam ocistit kveri
    //    for( int i=0;i<vec1.size();i++ ) query[ vec[i] ]; /// ovo valjda ocisti kveri ? skontat fino kako se cisti
        conquer( vec1 );
        conquer( vec2 );
    }


    void Solve(int n)
    {
        nn=n;///globalno n
        vector<int>vec;
        vec.clear();
        for ( int i=1;i<=2*n;i++)vec.pb(i);
        conquer( vec );
    }
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 10360 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 5368 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 10360 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 10360 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 10360 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 10360 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 10360 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 10360 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 10360 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -