제출 #371381

#제출 시각아이디문제언어결과실행 시간메모리
371381leinad2커다란 상품 (IOI17_prize)C++17
20 / 100
3047 ms1268 KiB
#include "prize.h"
#include<bits/stdc++.h>
using namespace std;
int A[200010];
int find_best(int n)
{
  int x=0;
    while(1)
    {
        int a=0, b=n-1;
        while(a<b)
        {
            int m=a+b>>1;
            vector<int>v=ask(m);x++;if(x==10000)for(;;);
            if(v[0]+v[1]==0)return m;
            if(v[1]>A[m+1])a=m+1;
            else b=m;
        }
        vector<int>v=ask(a);
      x++;if(x==10000)for(;;);
        if(v[0]+v[1]==0)return a;
        for(int i=0;i++<a;)A[i]++;
    }
}

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

prize.cpp: In function 'int find_best(int)':
prize.cpp:13:20: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   13 |             int m=a+b>>1;
      |                   ~^~
prize.cpp:20:23: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   20 |       x++;if(x==10000)for(;;);
      |                       ^~~
prize.cpp:21:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   21 |         if(v[0]+v[1]==0)return a;
      |         ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...