#include<bits/stdc++.h>
using namespace std;
enum{P=1049897357,Q=1063231361,B=499,G=95003};
int n,x,y,z;
string s;
unordered_set<int>v;
int main(){
 ios::sync_with_stdio(0),cin.tie(0);
 for(cin>>n;n--;v.emplace((x*668273ll%P+y)%P)){
  x=y=0,cin>>s;
  for(char c:s)x=(1ll*x*B+c-97)%P,y=(1ll*y*G+c-97)%Q;
 }
 cout<<v.size()<<'\n';
}

2 条评论

  • @ 2024-7-14 15:17:06

    抓到一个站长

    • @ 2021-11-25 18:35:25

      看起来是 unordered_set 常数比较大。

      • 1

      信息

      ID
      180
      时间
      1000ms
      内存
      256MiB
      难度
      3
      标签
      递交数
      2109
      已通过
      291
      上传者