結果
| 問題 | 
                            No.3331 Consecutive Cubic Sum
                             | 
                    
| コンテスト | |
| ユーザー | 
                             tau1235
                         | 
                    
| 提出日時 | 2025-11-02 21:27:53 | 
| 言語 | C++23  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 898 ms / 5,000 ms | 
| コード長 | 526 bytes | 
| コンパイル時間 | 3,306 ms | 
| コンパイル使用メモリ | 291,296 KB | 
| 実行使用メモリ | 237,740 KB | 
| 最終ジャッジ日時 | 2025-11-02 21:29:01 | 
| 合計ジャッジ時間 | 49,228 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 47 | 
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
  using ll=long long;
  using lll=__int128_t;
  ll m=1e6+10;
  ll n;
  cin>>n;
  vector<lll> p3(m);
  for (ll i=0;i<m;i++) p3[i]=i*i*i;
  map<lll,vector<ll>> mp;
  for (int i=1;i<m;i++){
    p3[i]+=p3[i-1];
    mp[p3[i]].push_back(i);
  }
  vector<pair<ll,ll>> ans;
  for (int i=0;i<m;i++){
    for (ll j:mp[n+p3[i]]){
      ans.push_back({i+1,j});
    }
  }
  int k=ans.size();
  cout<<k<<endl;
  for (int i=0;i<k;i++) cout<<ans[i].first<<" "<<ans[i].second<<endl;
}
            
            
            
        
            
tau1235