結果
| 問題 |
No.420 mod2漸化式
|
| ユーザー |
kurenai3110
|
| 提出日時 | 2016-10-31 14:54:14 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 586 bytes |
| コンパイル時間 | 1,923 ms |
| コンパイル使用メモリ | 70,948 KB |
| 実行使用メモリ | 821,560 KB |
| 最終ジャッジ日時 | 2024-11-25 00:06:01 |
| 合計ジャッジ時間 | 57,931 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | MLE * 1 |
| other | AC * 7 TLE * 24 MLE * 4 |
ソースコード
#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