結果

問題 No.1125 Without Parallelogram
ユーザー SSRSSSRS
提出日時 2020-07-22 23:39:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 478 bytes
コンパイル時間 2,221 ms
コンパイル使用メモリ 172,144 KB
実行使用メモリ 5,056 KB
最終ジャッジ日時 2023-09-05 05:08:54
合計ジャッジ時間 8,845 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,384 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 4 ms
4,376 KB
testcase_17 WA -
testcase_18 AC 5 ms
4,380 KB
testcase_19 WA -
testcase_20 AC 6 ms
4,376 KB
testcase_21 AC 6 ms
4,380 KB
testcase_22 AC 7 ms
4,380 KB
testcase_23 AC 6 ms
4,376 KB
testcase_24 AC 11 ms
4,380 KB
testcase_25 AC 9 ms
4,380 KB
testcase_26 AC 7 ms
4,380 KB
testcase_27 AC 8 ms
4,376 KB
testcase_28 AC 1 ms
4,384 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
bool ok(int n){
  int a = 1;
  set<int> st;
  st.insert(a);
  for (int i = 0; i < n - 1; i++){
    a *= 2;
    a %= n;
    st.insert(a);
  } 
  return st.size() == n - 1;
}
int main(){
  int N;
  cin >> N;
  int p = max(N + 1, 3);
  while (!ok(p)){
    p++;
  }
  vector<int> a = {1};
  for (int i = 0; i < N - 1 ; i++){
    a.push_back((a[i] * 2) % p);
  }
  for (int i = 0; i < N; i++){
    cout << i << ' ' << a[i] << endl;
  }
}
0