QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#394386#4913. 子集匹配biuldCompile Error//C++14471b2024-04-20 14:08:582024-04-20 14:09:00

Judging History

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

  • [2024-04-20 14:09:00]
  • 评测
  • [2024-04-20 14:08:58]
  • 提交

answer

#include<bits/stdc++.h>
#include"hall.h"
using namespace std;

inline int solve(int n, int k, int S){
	int mn = 0, p = 0, now = 0;
	for(int i = 1; i <= n; ++ i){
		if((S >> (n - i)) & 1){
			now ++;
		}
		else{
			now --;
		}
		if(now < mn){
			mn = now;
			p = i;
		}
	}
	int ans = 0;
	for(int i = 1; i <= n; ++ i){
		if(i - 1 == p){
			ans += (1 << (n - i));
		}
		else if((S >> (n - i) & 1)){
			ans += (1 << (n - i));
		}
	}
	return ans;
}

详细

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);
      |         ~~~~~^~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/cc7Q4d9G.o: in function `(anonymous namespace)::ask(int)':
implementer.cpp:(.text+0x2c): undefined reference to `solve(int, int, int)'
collect2: error: ld returned 1 exit status