제출 #245782

#제출 시각아이디문제언어결과실행 시간메모리
245782uacoder123Cave (IOI13_cave)C++14
100 / 100
247 ms640 KiB
#include <bits/stdc++.h>
#include <cave.h>
using namespace std;
void exploreCave(int N) {
  int n=N,co=0,ch=0;
  int arr[n]={},dno[n],f[n]={};
  while(co!=n)
  {
    int d=tryCombination(arr);
    if(d==-1)
    {
      ch=1;
      break;
    }
    int l=0,r=n-1,ans;
    while(l<r)
    {
      int m=(l+r+1)/2;
      for(int i=m;i<=r;++i)
        if(!f[i])
          arr[i]^=1;
      int res=tryCombination(arr);
        if(res==-1)
        {
          ch=1;
          break;
        }
        if(res<d)
        {
          d=res;
          l=m;
        }
        else if(res==d)
        {
          r=m-1;
        }
        else
        {
          for(int i=m;i<=r;++i)
        if(!f[i])
          arr[i]^=1;
          l=m;
        }
    }
    if(ch)
      break;
    ans=l;
    f[ans]=1;
    dno[ans]=d;
    arr[ans]^=1;
    co++;
  }
  if(co==n)
  {
    answer(arr,dno);
    exit(0);
  }
  else
  {
    for(int i=0;i<n;++i)
    {
      if(!f[i])
      {
        arr[i]^=1;
        dno[i]=tryCombination(arr);
        arr[i]^=1;
      }
    }
    answer(arr,dno);
    exit(0);
  }
}

컴파일 시 표준 에러 (stderr) 메시지

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:40:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
         if(!f[i])
         ^~
cave.cpp:42:11: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
           l=m;
           ^
#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...