QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#558105 | #8783. Cherry Picking | chenyueshan# | WA | 0ms | 3816kb | C++14 | 1.1kb | 2024-09-11 14:12:09 | 2024-09-11 14:12:13 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f3f3f3f3f
#define pb push_back
#define int long long
const int mod = 1e9 + 7;
const int N = 1e6 + 50;
int x[N];
void solve()
{
int n, k;
cin >> n >> k;
for (int i = 0; i < n; i++)
{
cin >> x[i];
}
string s;
cin >> s;
int min1 = 10000000000, min2 = 0;
int num = 0;
for (int i = 0; i < n - 1; i++)
{
if (s[i] == '1' && s[i + 1] == '1')
{
if (num == 0)
{
num = 2;
}
else
{
num++;
}
min1 = min(min1, x[i]);
min1 = min(min1, x[i + 1]);
}
else
{
if (num >= k)
{
min2 = max(min2, min1);
min1 = 10000000000;
num = 0;
}
}
}
cout << min2;
}
signed main()
{
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int T = 1;
// cin >> T;
while (T--)
{
solve();
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3816kb
input:
5 2 1 2 3 4 5 01101
output:
2
result:
ok answer is '2'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
5 2 3 4 5 2 1 10101
output:
0
result:
ok answer is '0'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3608kb
input:
1 1 1 1
output:
0
result:
wrong answer expected '1', found '0'