QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#558105#8783. Cherry Pickingchenyueshan#WA 0ms3816kbC++141.1kb2024-09-11 14:12:092024-09-11 14:12:13

Judging History

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

  • [2024-09-11 14:12:13]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3816kb
  • [2024-09-11 14:12:09]
  • 提交

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'