結果

問題 No.3015 アンチローリングハッシュ
ユーザー Ryuhei MoriRyuhei Mori
提出日時 2019-09-26 18:35:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 686 bytes
コンパイル時間 481 ms
コンパイル使用メモリ 58,796 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 15:38:40
合計ジャッジ時間 3,702 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 WA -
testcase_05 AC 1 ms
4,348 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <map>
#include <utility>

int a, b;

/*
aaaa
ABCD

(A-a) a^3 + (B-a) a^2 + (C-a) a + (D-a) = 0 mod b
*/

int main(){
  int i, j;
  std::map<int, std::pair<int, int> > m;
  scanf("%d%d",&a,&b);
  puts("aaaa");

  for(i=0;i<26;i++){
    for(j=0;j<26;j++){
      m.insert({(i * a + j) % b, std::pair<int, int>(i, j)});
    }
  }
  int a2 = (long long) a*a%b;
  for(i=0;i<26;i++){
    for(j=0;j<26;j++){
      if((i|j)==0) continue;
      int z = (long long) (i * a + j) * a2 % b;
      if(m.count(z)){
        std::pair<int, int> p = m[z];
        printf("%c%c%c%c\n", 'a'+i, 'a'+j, 'a'+p.first, 'a'+p.second);
        return 0;
      }
    }
  }

  return 0;
}
0