QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#182606 | #4913. 子集匹配 | zhoukangyang | 100 ✓ | 755ms | 20116kb | C++11 | 601b | 2023-09-18 10:58:51 | 2023-09-18 10:58:52 |
Judging History
answer
#include<bits/stdc++.h>
#include "hall.h"
#define L(i, j, k) for(int i = (j); i <= (k); ++i)
#define R(i, j, k) for(int i = (j); i >= (k); --i)
#define ll long long
#define vi vector < int >
#define sz(a) ((int) (a).size())
#define ll long long
#define ull unsigned long long
#define me(a, x) memset(a, x, sizeof(a))
using namespace std;
int solve(int n,int K,int s){
int sum = 0;
L(i, 0, n - 1) {
if(s >> i & 1) {
sum += i;
}
}
sum %= K;
L(i, 0, n - 1) {
if(s >> i & 1) {
if(sum == 0) {
return s - (1 << i);
}
--sum;
}
}
return -1;
}
详细
Test #1:
score: 5
Accepted
time: 1ms
memory: 3896kb
input:
14 8
output:
OK
result:
ok "OK"
Test #2:
score: 5
Accepted
time: 1ms
memory: 3740kb
input:
15 8
output:
OK
result:
ok "OK"
Test #3:
score: 5
Accepted
time: 1ms
memory: 3712kb
input:
15 9
output:
OK
result:
ok "OK"
Test #4:
score: 5
Accepted
time: 0ms
memory: 3664kb
input:
15 10
output:
OK
result:
ok "OK"
Test #5:
score: 5
Accepted
time: 3ms
memory: 3696kb
input:
18 10
output:
OK
result:
ok "OK"
Test #6:
score: 5
Accepted
time: 6ms
memory: 3728kb
input:
19 10
output:
OK
result:
ok "OK"
Test #7:
score: 5
Accepted
time: 5ms
memory: 3960kb
input:
19 11
output:
OK
result:
ok "OK"
Test #8:
score: 5
Accepted
time: 0ms
memory: 3836kb
input:
19 12
output:
OK
result:
ok "OK"
Test #9:
score: 5
Accepted
time: 41ms
memory: 4220kb
input:
22 12
output:
OK
result:
ok "OK"
Test #10:
score: 5
Accepted
time: 88ms
memory: 4884kb
input:
23 12
output:
OK
result:
ok "OK"
Test #11:
score: 5
Accepted
time: 69ms
memory: 4800kb
input:
23 13
output:
OK
result:
ok "OK"
Test #12:
score: 5
Accepted
time: 49ms
memory: 5780kb
input:
23 14
output:
OK
result:
ok "OK"
Test #13:
score: 5
Accepted
time: 159ms
memory: 5704kb
input:
24 13
output:
OK
result:
ok "OK"
Test #14:
score: 5
Accepted
time: 353ms
memory: 8028kb
input:
25 13
output:
OK
result:
ok "OK"
Test #15:
score: 5
Accepted
time: 296ms
memory: 8036kb
input:
25 14
output:
OK
result:
ok "OK"
Test #16:
score: 5
Accepted
time: 220ms
memory: 7708kb
input:
25 15
output:
OK
result:
ok "OK"
Test #17:
score: 5
Accepted
time: 677ms
memory: 12112kb
input:
26 14
output:
OK
result:
ok "OK"
Test #18:
score: 5
Accepted
time: 737ms
memory: 20116kb
input:
27 14
output:
OK
result:
ok "OK"
Test #19:
score: 5
Accepted
time: 742ms
memory: 19956kb
input:
27 15
output:
OK
result:
ok "OK"
Test #20:
score: 5
Accepted
time: 755ms
memory: 20080kb
input:
27 16
output:
OK
result:
ok "OK"