0%

2026天梯赛选拔赛-赛后总结

基本情况

image

还是有继续进步的这个空间的。

心得感悟

l1-3(while 写成 if)

image

l1-5(map 效率不够高)

原来使用了这个 map,对于 2e6 的这个数据,1000ms 的时限,可能不是很够。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <bits/stdc++.h>
#define debug(x) cerr<<#x<<":["<<x<<"]";
#define SZ(x) ((ll)x.size())
#define all(x) x.begin(),x.end()

using namespace std;
using ll = long long;
using DB = double;
const DB pi = acos(-1.0);
//const ll mod = 998244353;
const ll INF = (1ll<<61)-1;
ll lT;

void Solve(){
ll N,mod;
cin>>N>>mod;
vector<ll> A(N+2);
for(int i=1;i<=N;++i){
cin>>A[i];
}
// map<ll,ll> mp;
ll ans=0;
vector<ll> cnt(mod+2);
for(int i=1;i<=N;++i){
ll r=A[i]%mod;
cnt[r]++;
if (cnt[r]==2) {
++ans;
}
}
// for(auto it=mp.begin();it!=mp.end();++it){
// if(it->second>=2){
// ++ans;
// }
// }
cout<<ans<<"\n";
}
int main(){
cin.tie(0)->sync_with_stdio(false);
// cin>>lT;
// while(lT--)
Solve();
}
/*
AC
http://10.199.227.101/contest/1005/problem/L1-5/submission-detail/2134



*/

l1-7(+,-搞错了)

2026天梯赛选拔赛-L1-7-简单计数(赛时-号搞错成加号了,绷不住了)

image

l1-9(二分范围设置错误)

AC

http://10.199.227.101/contest/1005/problem/L1-9/submission-detail/2144

赛时 r 写了r=N。(确实是比较搞笑了,因为 n 可能比 diff 小,diff 是一个值,N 是数组大小)

image