QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#497715#6433. Klee in Solitary ConfinementUmokWA 1ms5624kbC++20813b2024-07-29 16:20:342024-07-29 16:20:34

Judging History

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

  • [2024-07-29 16:20:34]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5624kb
  • [2024-07-29 16:20:34]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define uint unsigned long long
#define int long long
#define endl '\n'
const int N = 2e6 + 5;
typedef pair<int, int> PII;
#define MAX LONG_LONG_MAX
int ar[N];
int mp[N * 4], t[N * 4];
void solve()
{
    int n, m, ans = 0;
    cin >> n >> m;

    for (int i = 1; i <= n;i ++)
    {
        cin >> ar[i], ar[i] += N;
        mp[ar[i]]++;
        ans = max(ans, mp[ar[i]]);
    }
    if(!m)
    {
        cout << ans << endl;
        return;
    }
    for (int i = 1; i <= n; i++)
    {
        t[ar[i]] = max(t[ar[i]] - 1, 0ll);
        t[ar[i] + m]++;
        ans = max(ans, t[ar[i] + m]);
    }
    cout << ans << endl;
}
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);

    solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 5624kb

input:

5 2
2 2 4 4 4

output:

3

result:

wrong answer 1st numbers differ - expected: '5', found: '3'