結果
| 問題 | 
                            No.33 アメーバがたくさん
                             | 
                    
| コンテスト | |
| ユーザー | 
                             184
                         | 
                    
| 提出日時 | 2014-10-03 00:30:41 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 825 bytes | 
| コンパイル時間 | 632 ms | 
| コンパイル使用メモリ | 74,780 KB | 
| 実行使用メモリ | 13,888 KB | 
| 最終ジャッジ日時 | 2024-09-24 09:50:59 | 
| 合計ジャッジ時間 | 7,182 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 8 TLE * 1 -- * 2 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:17:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   17 |         long long n,d,t;scanf("%lld%lld%lld",&n,&d,&t);
      |                         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:22:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   22 |                 scanf("%lld",&x);
      |                 ~~~~~^~~~~~~~~~~
            
            ソースコード
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#include <queue>
using namespace std;
/*
正解してたら匿名でも問題投稿ができる(実現度さらにアップ)!!!
 
*/
int main(){
	long long n,d,t;scanf("%lld%lld%lld",&n,&d,&t);
	
	map<long long,int> mp;
	for(int i=0;i<n;i++){
		long long x;
		scanf("%lld",&x);
		mp[x]++;
	}
	long long next,prev;
	map<long long,int>::iterator it;
	map<long long,int> nmp;
	while(t--){
		for(it=mp.begin();it!=mp.end();it++){
			next=it->first+d;
			prev=it->first-d;
			nmp[next]++;
			nmp[prev]++;
			nmp[it->first]++;
		} 
		mp=nmp;
	}
	long long ans=0;
	for(it=mp.begin();it!=mp.end();it++){
		if(it->second)ans++;
	}
	printf("%lld\n",ans);
	
	return 0;
} 
            
            
            
        
            
184