QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#400972#4913. 子集匹配11d10xyCompile Error//C++17288b2024-04-27 19:22:522024-04-27 19:22:52

Judging History

你现在查看的是最新测评结果

  • [2024-04-27 19:22:52]
  • 评测
  • [2024-04-27 19:22:52]
  • 提交

answer

#include"hall.h"
int solve(int n,int _,int s){
   int a[30]{},m=1,tg=0;
   a[1]=0;
   for(int i=0;i<n;i++)if(s>>i&1&&(a[m]|tg)!=(s&(1<<i)-1))
   m--,assert(m>0),tg|=1<<i;
   else a[m+1]=a[m]|1<<i,m++;
   for(int i=1;i<=m;i++)if((a[i]|tg)==s)return a[i-1]|tg;
   return -114514;
}

Details

implementer.cpp: In function ‘int main()’:
implementer.cpp:37:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   37 |         scanf("%d %d",&n,&K); assert(1<=n&&n<=27&&2*K>n);
      |         ~~~~~^~~~~~~~~~~~~~~
answer.code: In function ‘int solve(int, int, int)’:
answer.code:6:8: error: ‘assert’ was not declared in this scope
    6 |    m--,assert(m>0),tg|=1<<i;
      |        ^~~~~~
answer.code:2:1: note: ‘assert’ is defined in header ‘<cassert>’; did you forget to ‘#include <cassert>’?
    1 | #include"hall.h"
  +++ |+#include <cassert>
    2 | int solve(int n,int _,int s){