QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#394232#4913. 子集匹配hswfwkjCompile Error//C++14447b2024-04-20 10:28:352024-04-20 10:28:36

Judging History

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

  • [2024-04-20 10:28:36]
  • 评测
  • [2024-04-20 10:28:35]
  • 提交

answer

#include<bits/stdc++.h>
#include "hall.h"
using namespace std;
int solve(int n, int K, int s)
{
	int mn = 0, pos = 0, num = 0;
	for(int i = 1; i <= n; i++)
	{
		if(s & (1 << i - 1)) num++;
		else num--;
		if(num < mn) mn = num, pos = i;
	}
	return s ^ (1 << pos);
}
int main()
{

	return 0;
	// int n, k, s; int cnt = 3;
	// cin >> n >> k;
	// while(cnt--)
	// {
		// cin >> s;
		// cout << solve(n, k, s) << '\n';
	// }
}

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);
      |         ~~~~~^~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/cci9mqzW.o: in function `main':
answer.code:(.text.startup+0x0): multiple definition of `main'; /tmp/ccvlvMEY.o:implementer.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status