QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#110616#4913. 子集匹配Crysfly100 ✓1487ms19896kbC++171008b2023-06-02 23:20:022023-06-02 23:20:04

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-02 23:20:04]
  • 评测
  • 测评结果:100
  • 用时:1487ms
  • 内存:19896kb
  • [2023-06-02 23:20:02]
  • 提交

answer

#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
using namespace std;
inline int read()
{
	char c=getchar();int x=0;bool f=0;
	for(;!isdigit(c);c=getchar())f^=!(c^45);
	for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
	if(f)x=-x;return x;
}

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;

#define maxn 500005
#define inf 0x3f3f3f3f

/*
10110101101
11100101101
  /\
 /  \  /
/    \/
*/

int solve(int n,int k,int s){
	int mn=0,c=0,id=0;
	For(i,0,n-1){
		if(s>>i&1)++c;
		else --c;
		if(c>mn) mn=c,id=i;
	}
//	cout<<"id "<<id<<endl;
	return s^(1<<id);
}

//signed main(){
//	int n=6,k=4;
//	For(i,0,(1<<n)-1)
//		if(__builtin_popcount(i)==k){
//			int t=solve(n,k,i);
//			if(__builtin_popcount(t)!=k-1)puts("wa");
//			cout<<i<<" "<<t<<"\n";
//		}
//}

/*
111110

101110
011110

*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 5
Accepted
time: 2ms
memory: 3628kb

input:

14 8

output:

OK

result:

ok "OK"

Test #2:

score: 5
Accepted
time: 0ms
memory: 3560kb

input:

15 8

output:

OK

result:

ok "OK"

Test #3:

score: 5
Accepted
time: 0ms
memory: 3400kb

input:

15 9

output:

OK

result:

ok "OK"

Test #4:

score: 5
Accepted
time: 2ms
memory: 3552kb

input:

15 10

output:

OK

result:

ok "OK"

Test #5:

score: 5
Accepted
time: 5ms
memory: 3592kb

input:

18 10

output:

OK

result:

ok "OK"

Test #6:

score: 5
Accepted
time: 8ms
memory: 3480kb

input:

19 10

output:

OK

result:

ok "OK"

Test #7:

score: 5
Accepted
time: 3ms
memory: 3620kb

input:

19 11

output:

OK

result:

ok "OK"

Test #8:

score: 5
Accepted
time: 6ms
memory: 3644kb

input:

19 12

output:

OK

result:

ok "OK"

Test #9:

score: 5
Accepted
time: 50ms
memory: 3956kb

input:

22 12

output:

OK

result:

ok "OK"

Test #10:

score: 5
Accepted
time: 107ms
memory: 4544kb

input:

23 12

output:

OK

result:

ok "OK"

Test #11:

score: 5
Accepted
time: 84ms
memory: 4580kb

input:

23 13

output:

OK

result:

ok "OK"

Test #12:

score: 5
Accepted
time: 65ms
memory: 4536kb

input:

23 14

output:

OK

result:

ok "OK"

Test #13:

score: 5
Accepted
time: 187ms
memory: 5608kb

input:

24 13

output:

OK

result:

ok "OK"

Test #14:

score: 5
Accepted
time: 422ms
memory: 7652kb

input:

25 13

output:

OK

result:

ok "OK"

Test #15:

score: 5
Accepted
time: 380ms
memory: 7720kb

input:

25 14

output:

OK

result:

ok "OK"

Test #16:

score: 5
Accepted
time: 281ms
memory: 7616kb

input:

25 15

output:

OK

result:

ok "OK"

Test #17:

score: 5
Accepted
time: 1051ms
memory: 11752kb

input:

26 14

output:

OK

result:

ok "OK"

Test #18:

score: 5
Accepted
time: 1487ms
memory: 19784kb

input:

27 14

output:

OK

result:

ok "OK"

Test #19:

score: 5
Accepted
time: 1434ms
memory: 19896kb

input:

27 15

output:

OK

result:

ok "OK"

Test #20:

score: 5
Accepted
time: 1353ms
memory: 19836kb

input:

27 16

output:

OK

result:

ok "OK"