結果
| 問題 | No.420 mod2漸化式 |
| コンテスト | |
| ユーザー |
kurenai3110
|
| 提出日時 | 2016-10-31 14:54:14 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 586 bytes |
| 記録 | |
| コンパイル時間 | 748 ms |
| コンパイル使用メモリ | 92,252 KB |
| 実行使用メモリ | 1,314,880 KB |
| 最終ジャッジ日時 | 2026-05-19 05:45:43 |
| 合計ジャッジ時間 | 4,225 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | MLE * 2 -- * 33 |
ソースコード
#include <iostream>
#include <queue>
#include <map>
using namespace std;
int main() {
int x;cin>>x;
if(x==0){
cout<<1<<" "<<0<<endl;
return 0;
}
int cnt=0;
long long ans=0;
queue<pair<long long ,long long>>que;
que.push(make_pair(1,1));
while(!que.empty()){
pair<long long,long long> p;
p = que.front();que.pop();
if(p.second==x){
cnt++;
ans+= p.first;
}
if(p.second<=x){
if(p.first*2<=2147483647)que.push(make_pair(p.first*2,p.second));
if(p.first*2+1<=2147483647)que.push(make_pair(p.first*2+1,p.second+1));
}
}
cout<<cnt<<" "<<ans<<endl;
return 0;
}
kurenai3110