QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#184846 | #6433. Klee in Solitary Confinement | 2197181078 | WA | 0ms | 3692kb | C++14 | 1.4kb | 2023-09-21 13:30:23 | 2023-09-21 13:30:24 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define mod 998244353
#define ffor(n) for(int i = 0;i < n;++i)
const int N = 2000006;
using namespace std;
void build_log();
int mv_x[4] = {1,0,-1,0};
int mv_y[4] = {0,1,0,-1};
int year[2][15] = {{31,28,31,30,31,30,31,31,30,31,30,31},{31,29,31,30,31,30,31,31,30,31,30,31}};//1æ¯é°å¹´,0æ¯éé°å¹´
int t;
int m_log2[500005]; // log2(x) + 1
int k;
int n,m;
int h;
vector<pair<int,int>>v;
map<int,int>mm;
signed main()
{
//ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
cin>>n>>m;
int a = 0;
int x;
int sum = 0;
int mmax = 0;
ffor(n)
{
cin>>a;
if(i == 0)
{
x = a;
sum = 1;
}
else if(x == a)
{
sum++;
}
else if( x != a)
{
v.push_back({x,sum});
sum = 1;
x = a;
}
mm[a]++;
mmax = max(mmax,mm[a]);
}
v.push_back({x,sum});
ffor(v.size())
{
mmax = max(mmax,mm[v[i].first + m] + v[i].second);
}
cout<<mmax<<endl;
return 0;
}
void build_log()
{
for(int i = 1;i <= n;i++)
{
m_log2[i] = m_log2[i-1] + ((1 << m_log2[i-1]) == i);
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3524kb
input:
5 2 2 2 4 4 4
output:
5
result:
ok 1 number(s): "5"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
7 1 3 2 3 2 2 2 3
output:
6
result:
ok 1 number(s): "6"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
7 1 2 3 2 3 2 3 3
output:
5
result:
ok 1 number(s): "5"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
9 -100 -1 -2 1 2 -1 -2 1 -2 1
output:
3
result:
ok 1 number(s): "3"
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 3692kb
input:
200 121649 0 527189 -1000000 -306471 -998939 527189 -1000000 -1000000 0 527189 0 527189 0 527189 -306471 -998939 -306471 -306471 -306471 0 0 527189 527189 1000000 527189 -1000000 1000000 648838 -1000000 -998939 -998939 -998939 0 1000000 -1000000 -998939 527189 1000000 648838 -1000000 1000000 648838 ...
output:
32
result:
wrong answer 1st numbers differ - expected: '37', found: '32'