Submission #1024433

# Submission time Handle Problem Language Result Execution time Memory
1024433 2024-07-16T05:08:56 Z ZHIRDILBILDIZ Cave (IOI13_cave) C++14
0 / 100
2 ms 1116 KB
#include<bits/stdc++.h>
#include"cave.h"
using namespace std ;
void exploreCave(int N)
{
    vector<int> un_us, us;
    int S[N], D[N] ;
    for(int i = 0 ; i < N ; i++)
        un_us.push_back(i), D[i] = 0 ;
    for(int i = 0 ; i < N ; i++)
    {
        for(int j : un_us)
            S[j] = 0;
        if(1 == i)
        {
            int l = -1, r = un_us.size() ;
            while(l + 1 < r)
            {
                int mid = (l + r) >> 1 ;
                for(int j = 0 ; j <= mid ; j++)
                    S[un_us[j]] = 1 ;
                if(1 == i)l = mid ;
                else r = mid ;
                for(int j = 0 ; j <= mid ; j++)
                    S[un_us[j]] = 0 ;
            }
            us.push_back(un_us[r]) ;
            un_us.erase(r + un_us.begin()) ;
            D[us.back()] = i ;
            S[us.back()] = 1 ;
        }
        else
        {
            int l = -1, r = un_us.size() ;
            while(l + 1 < r)
            {
                int mid = (l + r) >> 1 ;
                for(int j = 0 ; j <= mid ; j++)
                    S[un_us[j]] = 1 ;
                if(1 == i)r = mid ;
                else l = mid ;
                for(int j = 0 ; j <= mid ; j++)
                    S[un_us[j]] = 0 ;
            }
            us.push_back(un_us[r]) ;
            un_us.erase(r + un_us.begin()) ;
            D[us.back()] = i ;
            S[us.back()] = 0 ;
        }
    }
    answer(S, D);
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 860 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 1116 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 860 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -