QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#73276 | #1438. Balls | zhangboju# | WA | 2ms | 3704kb | C++14 | 480b | 2023-01-23 13:03:27 | 2023-01-23 13:03:28 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
template <typename T> inline void read(T &x)
{
x=0;short f=1;char c=getchar();
for(;c<'0'||c>'9';c=getchar()) if(c=='-') f=-1;
for(;c>='0'&&c<='9';c=getchar()) x=(x<<1)+(x<<3)+(c^48);
x*=f;return;
}
const int N=1e5+5;
int n;
int a[N];
set<int>S;
int main()
{
read(n);
for(int i=1;i<=n;++i) read(a[i]);
for(int i=1;i+2<=n;++i)
if(a[i]==a[i+1]||a[i]==a[i+2])
S.insert(a[i]);
printf("%d\n",S.size());
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3504kb
input:
7 3 1 3 2 1 2 3
output:
2
result:
ok "2"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3428kb
input:
10 31692384 31692384 31692384 31692384 31692384 31692385 31692384 31692385 31692385 31692385
output:
2
result:
ok "2"
Test #3:
score: 0
Accepted
time: 2ms
memory: 3488kb
input:
10 41086958 41086959 41086959 41086958 41086958 41086959 41086959 41086959 41086958 41086959
output:
2
result:
ok "2"
Test #4:
score: 0
Accepted
time: 2ms
memory: 3552kb
input:
10 30400813 30400814 30400814 30400813 30400814 30400813 30400813 30400813 30400814 30400814
output:
2
result:
ok "2"
Test #5:
score: 0
Accepted
time: 2ms
memory: 3532kb
input:
10 41086958 41086958 41086958 41086960 41086960 41086959 41086959 41086959 41086958 41086958
output:
3
result:
ok "3"
Test #6:
score: 0
Accepted
time: 2ms
memory: 3524kb
input:
10 30400813 30400815 30400815 30400813 30400814 30400815 30400815 30400813 30400813 30400814
output:
2
result:
ok "2"
Test #7:
score: 0
Accepted
time: 2ms
memory: 3528kb
input:
10 40894490 40894491 40894490 40894490 40894491 40894490 40894490 40894490 40894489 40894490
output:
1
result:
ok "1"
Test #8:
score: -100
Wrong Answer
time: 0ms
memory: 3704kb
input:
10 30400813 30400814 30400814 30400813 30400816 30400813 30400815 30400813 30400816 30400816
output:
2
result:
wrong answer 1st words differ - expected: '3', found: '2'