QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#497715 | #6433. Klee in Solitary Confinement | Umok | WA | 1ms | 5624kb | C++20 | 813b | 2024-07-29 16:20:34 | 2024-07-29 16:20:34 |
Judging History
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;
}
詳細信息
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'