Submission #16204

# Submission time Handle Problem Language Result Execution time Memory
16204 2015-08-17T11:26:10 Z mindol Cave (IOI13_cave) C++
0 / 100
7 ms 512 KB
#include "cave.h"
int door[5001],a[5001];
bool ans[5001]; int where[5001];
void exploreCave(int N) {
    for(int i=0;i<N;i++)
    {
        int s=0,e=N-1;

        for(int j=0;j<N;j++)
            if(ans[j]==0) a[j]=0;

        int res=tryCombination(a);

        if(res!=i)
        {
            for(int j=0;j<N;j++)
                if(ans[j]==0) a[j]=1;
        }

        while(s<=e)
        {
            int mid=(s+e)/2;
            for(int j=s;j<=mid;j++)
                if(ans[j]==0) a[j]=!a[j];
            int res=tryCombination(a);

            if(res==i) // 뒷쪽에 있음
            {
                for(int j=s;j<=mid;j++)
                    if(ans[j]==0) a[j]=!a[j];
                s=mid+1;
            }
            else // 앞쪽에 있음
            {
                for(int j=s;j<=mid;j++)
                    if(ans[j]==0) a[j]=!a[j];
                e=mid;
            }
        }
        ans[s]=true;
        where[s]=i;
        door[s]=!a[s];
    }
    answer(door,where);
}
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 512 KB too much calls on tryCombination()
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 512 KB too much calls on tryCombination()
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 512 KB too much calls on tryCombination()
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 512 KB too much calls on tryCombination()
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 512 KB too much calls on tryCombination()
2 Halted 0 ms 0 KB -