結果
| 問題 | No.2102 [Cherry Alpha *] Conditional Reflection |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-10-15 00:19:43 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 620 bytes |
| 記録 | |
| コンパイル時間 | 2,713 ms |
| コンパイル使用メモリ | 83,188 KB |
| 実行使用メモリ | 15,488 KB |
| 最終ジャッジ日時 | 2026-03-13 12:56:11 |
| 合計ジャッジ時間 | 19,191 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 WA * 58 |
ソースコード
#include<iostream>
#include<set>
using namespace std;
const int mod=1000000097;
long base[1<<20];
int N;
int main()
{
base[0]=1;
for(int i=1;i<1<<20;i++)base[i]=base[i-1]*3%mod;
cin>>N;
set<int>V;
for(;N--;)
{
string S;cin>>S;
int now=0;
for(int i=0;i<S.size();i++)now=(now+base[i]*S[i])%mod;
bool fn=V.find(now)!=V.end();
for(int i=1;i<S.size();i++)
{
int tmp=now;
tmp=(tmp-base[i-1]*S[i-1])%mod;
tmp=(tmp-base[i]*S[i])%mod;
tmp=(tmp+base[i-1]*S[i])%mod;
tmp=(tmp+base[i]*S[i-1])%mod;
if(V.find((tmp+mod)%mod)!=V.end())fn=true;
}
cout<<(fn?"Yes\n":"No\n");
V.insert(now);
}
}