#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 comments

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

    抓到一个站长

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

      看起来是 unordered_set 常数比较大。

      • 1

      Information

      ID
      180
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      3
      Tags
      # Submissions
      2686
      Accepted
      357
      Uploaded By