Submission #167455

# Submission time Handle Problem Language Result Execution time Memory
167455 2019-12-08T15:18:34 Z wildturtle Cave (IOI13_cave) C++14
0 / 100
678 ms 512 KB
#include"cave.h"
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,i,e,f,g,n,m,k,l,A[200005],B[200005],C[200005],D[200005],mid,le,ri;
int go(int x,int y) {
           for(int i=0;i<n;i++) {
                      if(B[i]>0) A[i]=B[i]-1;
                      else { if(x<=i && i<=y) A[i]=1;
                                 else A[i]=0;
                      }
           }
           return tryCombination(A);
}
int go1(int x,int y) {
           for(int i=0;i<n;i++) {
                      if(B[i]>0) A[i]=B[i]-1;
                      else { if(x>i || i>y) A[i]=0;
                                 else A[i]=1;
                      }
           }           
           return tryCombination(A);
}
void exploreCave(int N) {
           n=N;
           for(int i=0;i<n;i++) {
                      le=0; ri=n-1;
                      a=0;
                      c=go(0,n-1);
                      if(c>i || c==-1) a=1;
                      while(le<=ri) {
                                 mid=(le+ri)/2;
                                 if(a==1) {
                                            c=go(le,mid);
                                            if(c>i || c==-1) le=mid;
                                            else ri=mid+1;
                                 }
                                 else {
                                            c=go1(le,mid);
                                            if(c>i || c==-1) le=mid;
                                            else ri=mid+1;
                                 }
                      }
                      if(c==1) B[i]=2;
                      else B[i]=1;
                      C[i]=c;
                      D[i]=mid;
           }
           answer(C,D);
}
# Verdict Execution time Memory Grader output
1 Incorrect 417 ms 512 KB too much calls on tryCombination()
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 678 ms 496 KB too much calls on tryCombination()
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 384 KB too much calls on tryCombination()
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 384 KB too much calls on tryCombination()
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 417 ms 512 KB too much calls on tryCombination()
2 Halted 0 ms 0 KB -