結果

問題 No.1125 Without Parallelogram
ユーザー SSRSSSRS
提出日時 2020-07-22 23:40:09
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 497 bytes
コンパイル時間 1,510 ms
コンパイル使用メモリ 173,708 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-23 01:42:11
合計ジャッジ時間 7,168 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26 RE * 2
権限があれば一括ダウンロードができます

ソースコード

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, 3);
  while (!ok(p)){
    p++;
  }
  assert(p <= N + 41);
  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