結果

問題 No.2102 [Cherry Alpha *] Conditional Reflection
ユーザー umezoumezo
提出日時 2022-10-15 00:53:50
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,110 bytes
コンパイル時間 2,672 ms
コンパイル使用メモリ 211,868 KB
実行使用メモリ 70,764 KB
最終ジャッジ日時 2023-09-09 01:33:32
合計ジャッジ時間 71,320 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 676 ms
32,540 KB
testcase_03 AC 889 ms
44,992 KB
testcase_04 AC 683 ms
32,004 KB
testcase_05 AC 441 ms
19,608 KB
testcase_06 AC 734 ms
34,172 KB
testcase_07 AC 1,031 ms
61,512 KB
testcase_08 AC 184 ms
9,112 KB
testcase_09 AC 897 ms
49,428 KB
testcase_10 AC 283 ms
14,256 KB
testcase_11 AC 265 ms
19,796 KB
testcase_12 AC 547 ms
30,028 KB
testcase_13 AC 1,060 ms
56,572 KB
testcase_14 AC 542 ms
25,740 KB
testcase_15 AC 817 ms
36,168 KB
testcase_16 AC 1,244 ms
57,356 KB
testcase_17 AC 605 ms
40,804 KB
testcase_18 AC 1,050 ms
60,328 KB
testcase_19 AC 378 ms
20,200 KB
testcase_20 AC 1,303 ms
60,260 KB
testcase_21 AC 315 ms
13,060 KB
testcase_22 AC 1,438 ms
65,204 KB
testcase_23 AC 1,388 ms
65,256 KB
testcase_24 AC 1,429 ms
65,260 KB
testcase_25 AC 1,449 ms
65,440 KB
testcase_26 AC 1,596 ms
65,200 KB
testcase_27 AC 1,473 ms
65,316 KB
testcase_28 AC 1,446 ms
65,212 KB
testcase_29 AC 1,449 ms
65,520 KB
testcase_30 AC 1,476 ms
65,264 KB
testcase_31 AC 1,475 ms
65,196 KB
testcase_32 AC 1,463 ms
65,208 KB
testcase_33 AC 1,435 ms
65,264 KB
testcase_34 AC 1,442 ms
65,212 KB
testcase_35 AC 1,467 ms
65,216 KB
testcase_36 AC 1,630 ms
65,212 KB
testcase_37 AC 1,483 ms
65,208 KB
testcase_38 AC 1,445 ms
65,204 KB
testcase_39 AC 1,483 ms
65,272 KB
testcase_40 AC 1,621 ms
65,340 KB
testcase_41 AC 1,451 ms
65,320 KB
testcase_42 AC 973 ms
26,512 KB
testcase_43 AC 969 ms
26,532 KB
testcase_44 AC 975 ms
26,584 KB
testcase_45 AC 973 ms
26,516 KB
testcase_46 AC 969 ms
26,520 KB
testcase_47 AC 1,318 ms
69,084 KB
testcase_48 AC 1,341 ms
68,776 KB
testcase_49 AC 1,330 ms
68,832 KB
testcase_50 AC 1,348 ms
68,840 KB
testcase_51 AC 1,309 ms
68,824 KB
testcase_52 RE -
testcase_53 RE -
testcase_54 RE -
testcase_55 AC 1,035 ms
64,288 KB
testcase_56 AC 1,036 ms
64,288 KB
testcase_57 AC 1,027 ms
64,340 KB
testcase_58 RE -
testcase_59 AC 1,531 ms
70,764 KB
testcase_60 AC 169 ms
8,220 KB
testcase_61 AC 1,019 ms
64,600 KB
testcase_62 AC 17 ms
4,384 KB
testcase_63 AC 255 ms
8,112 KB
testcase_64 AC 228 ms
7,792 KB
testcase_65 AC 282 ms
8,328 KB
testcase_66 AC 1,455 ms
63,772 KB
testcase_67 AC 343 ms
12,440 KB
testcase_68 AC 88 ms
4,608 KB
testcase_69 AC 333 ms
12,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;

ll MOD1=25297664415509;
ll MOD2=51079899000569;

int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  random_device rd;
  mt19937_64 rnd(rd());    
  uniform_int_distribution<ll> dist_n1(100000001,99999999999),dist_n2(100000001,99999999999);
  
  int n;
  cin>>n;
  vector<string> S(n);
  rep(i,n) cin>>S[i];
  
  vector<ll> A(n),B(n);
  rep(i,n){
    ll a=dist_n1(rnd),b=dist_n2(rnd);
    A[i]=a,B[i]=b;
  }
  
  set<pair<ll,ll>> s;
  rep(i,n){
    ll sum1=0,sum2=0;
    int k=S[i].size();
    rep(j,k){
      sum1=(sum1+A[j]*S[i][j]%MOD1)%MOD1;
      sum2=(sum2+B[j]*S[i][j]%MOD2)%MOD2;
    }
    if(s.count({sum1,sum2})) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    s.insert({sum1,sum2});
    rep(j,k-1){
      ll a=(sum1-A[j]*S[i][j]-A[j+1]*S[i][j+1]+A[j]*S[i][j+1]+A[j+1]*S[i][j]+2*MOD1)%MOD1;
      ll b=(sum2-B[j]*S[i][j]-B[j+1]*S[i][j+1]+B[j]*S[i][j+1]+B[j+1]*S[i][j]+2*MOD2)%MOD2;
      s.insert({a,b});
    }
  }

  return 0;
}
0