QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#394294#4913. 子集匹配juruoACompile Error//C++14232b2024-04-20 11:05:182024-04-20 11:05:18

Judging History

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

  • [2024-04-20 11:05:18]
  • 评测
  • [2024-04-20 11:05:18]
  • 提交

answer

#include "hall.h"
typedef long long li;
void solve(li n, li k, li s){
	li p = -1, w = 0, pw = 0;
	for(li i = 0; i < n; i++){
		if((s >> i) & 1) w--;
		else w++;
		if(w >= pw) pw = w, p = i;
	}
	return s ^ (1 << (p + 1));
}

詳細信息

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 ‘void solve(li, li, li)’:
answer.code:10:18: error: return-statement with a value, in function returning ‘void’ [-fpermissive]
   10 |         return s ^ (1 << (p + 1));
      |                ~~^~~~~~~~~~~~~~~~