代码部分 bitset做法 题解大家去看官方的吧

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e5+10;
const int mod = 998244353;
const int P=131;
const double PI=acos(-1);
typedef pair<int, int> PII;
typedef pair<int,string> PIS;
#define x first
#define y second
typedef long long LL;
typedef unsigned long long ULL;
#define pb push_back
int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, -1, 1};
int get(int x)
{
   bitset<64>y1;
   bitset<64>x1(x);
   y1[0]=x1[0]^0;
   for(int i=1;i<=63;i++)
   {
      y1[i]=(x1[i-1]&y1[i-1])^x1[i];
   }
   int res=y1.to_ullong();
   return res;
}
void solve()
{
   int n;
   cin>>n;
   vector<int>a(n+1);
   for(int i=1;i<=n;i++)
   {
      cin>>a[i];
   }
   map<int,int>mp;
   for(int i=1;i<=n;i++)
   {
      int tar=get(a[i]);
      if(mp[tar]!=0)
      {
         cout<<mp[tar]<<" "<<i<<"\n";
         return;
      }
      mp[a[i]]=i;
   }
   cout<<-1<<"\n";
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int T = 1;
    //cin>>T;
   for(int i=1;i<=T;i++) 
   {
      solve();
   }
    return 0;
}