結果
| 問題 | 
                            No.1498 Factorization from -1 to 1
                             | 
                    
| ユーザー | 
                             tko919
                         | 
                    
| 提出日時 | 2021-05-04 11:27:53 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,090 bytes | 
| コンパイル時間 | 2,041 ms | 
| コンパイル使用メモリ | 202,104 KB | 
| 最終ジャッジ日時 | 2025-01-21 06:40:59 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 WA * 2 | 
| other | AC * 10 WA * 7 | 
ソースコード
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
//template
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(v) (v).begin(),(v).end()
using ll=long long int;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
//end
const int L=101010;
ll a[L];
map<int,int> ds[L];
int main(){
   rep(x,1,L)a[x]=1LL*x*x+1;
   rep(x,1,L)if(a[x]!=1){
      ll p=a[x];
      for(ll y=x;y<L;y+=p){
         while(a[y]%p==0){
            a[y]/=p;
            ds[y][p]++;
         }
      }
      for(ll y=p-x;y<L;y+=p){
         while(a[y]%p==0){
            a[y]/=p;
            ds[y][p]++;
         }
      }
   }
   
   int q;
   cin>>q;
   while(q--){
      int x;
      cin>>x;
      vector<int> res;
      for(auto& [p,c]:ds[x]){
         rep(_,0,c)res.push_back(p);
      }
      rep(i,0,res.size())cout<<res[i]<<(i==(int)res.size()-1?'\n':' ');
   }
   return 0;
}
            
            
            
        
            
tko919