結果

問題 No.3115 One Power One Kill
ユーザー hiromi_ayase
提出日時 2025-04-20 20:57:57
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,188 bytes
コンパイル時間 6,081 ms
コンパイル使用メモリ 332,712 KB
実行使用メモリ 26,380 KB
平均クエリ数 2.00
最終ジャッジ日時 2025-04-20 20:58:06
合計ジャッジ時間 9,013 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17 WA * 3
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘std::tuple<int, int, std::map<int, int, std::less<int>, std::allocator<std::pair<const int, int> > > > search()’:
main.cpp:53:1: warning: control reaches end of non-void function [-Wreturn-type]
   53 | }
      | ^

ソースコード

diff #

#include <bits/stdc++.h>

#include <atcoder/all>
using namespace std;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
#define FAST_IO                \
  ios::sync_with_stdio(false); \
  cin.tie(0);
const i64 INF = 1001001001001001001;
using Modint = atcoder::static_modint<1000000007>;

int pow(i64 X, int e, int m) {
  i64 res = 1;
  while (e > 0) {
    if (e & 1) {
      res = (res * X) % m;
    }
    X = (X * X) % m;
    e >>= 1;
  }
  return res;
}

tuple<int, int, map<int, int>> search() {
  for (int A = 100; A <= 1000; A ++) {
    for (int B = 100; B <= 1000; B ++) {
      int Y = pow(A, B, 1e9 + 7);

      bool ok = true;
      map<int, int> mp;

      for (int X = 1; X <= 10000; X ++) {
        int K = gcd(X, Y);
        int Xd = pow(X, A, B);
        if (mp.count(K) == 0) {
          mp[K] = Xd;
        } else {
          if (mp[K] != Xd) {
            ok = false;
            break;
          }
        }
      }
      if (ok) {
        return {A, B, mp};
      }
    }
  }

}

int main() {
  FAST_IO

  auto [A, B, mp] = search();


  cout << A << " " << B << endl;

  int K;
  cin >> K;

  cout << mp[K] << endl;

}
0