結果

問題 No.33 アメーバがたくさん
ユーザー 184184
提出日時 2014-10-02 23:59:52
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,030 bytes
コンパイル時間 735 ms
コンパイル使用メモリ 75,488 KB
実行使用メモリ 15,244 KB
最終ジャッジ日時 2023-10-24 17:36:54
合計ジャッジ時間 7,343 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
15,244 KB
testcase_01 WA -
testcase_02 AC 2 ms
4,348 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:17:36: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=]
   17 |         long long n,d,t;scanf("%I64d%I64d%I64d",&n,&d,&t);
      |                                ~~~~^            ~~
      |                                    |            |
      |                                    int*         long long int*
      |                                %I64lld
main.cpp:17:41: warning: format ‘%d’ expects argument of type ‘int*’, but argument 3 has type ‘long long int*’ [-Wformat=]
   17 |         long long n,d,t;scanf("%I64d%I64d%I64d",&n,&d,&t);
      |                                     ~~~~^          ~~
      |                                         |          |
      |                                         int*       long long int*
      |                                     %I64lld
main.cpp:17:46: warning: format ‘%d’ expects argument of type ‘int*’, but argument 4 has type ‘long long int*’ [-Wformat=]
   17 |         long long n,d,t;scanf("%I64d%I64d%I64d",&n,&d,&t);
      |                                          ~~~~^        ~~
      |                                              |        |
      |                                              int*     long long int*
      |                                          %I64lld
main.cpp:22:20: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=]
   22 |         scanf("%I64d",&x);
      |                ~~~~^  ~~
      |                    |  |
      |                    |  long long int*
      |                    int*
      |                %I64lld
main.cpp:46:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
   46 |     printf("%I64d\n",ans);
      |             ~~~~^    ~~~
      |                 |    |
      |                 int  lon

ソースコード

diff #

#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("%I64d%I64d%I64d",&n,&d,&t);
	
	map<long long,int> mp;
    for(int i=0;i<n;i++){
    	long long x;
    	scanf("%I64d",&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]++;
    	}
    	map<long long,int> nnmp;
    	for(it=nmp.begin();it!=nmp.end();it++){
    		if(it->second==1)nnmp[it->first]=1;
    	}
    	mp=nnmp;
    }
    long long ans=0;
    for(it=mp.begin();it!=mp.end();it++){
    	if(it->second)ans++;
    }
    printf("%I64d\n",ans);
    
	return 0;
} 
0