結果
| 問題 |
No.33 アメーバがたくさん
|
| コンテスト | |
| ユーザー |
184
|
| 提出日時 | 2014-10-04 05:37:01 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 889 bytes |
| コンパイル時間 | 706 ms |
| コンパイル使用メモリ | 78,616 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-24 09:54:45 |
| 合計ジャッジ時間 | 1,204 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | RE * 10 OLE * 1 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:22:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
22 | scanf("%lld%lld%lld",&n,&d,&t);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#include <queue>
using namespace std;
/*
正解してたら匿名でも問題投稿ができる(実現度さらにアップ)!!!
またコンパイルエラーでてないのにCE
1行のバグだったけど気づくのが大変だった・・・
*/
int main(){
long long n,d,t,x[101];
scanf("%lld%lld%lld",&n,&d,&t);
map<long long,long long> mp;
vector<long long> ps;
for(int i=0;i<n;i++){
ps.push_back(x[i]);
}
sort(ps.begin(),ps.end());
long long diff[101];
long long inc=1+t+t;
mp[0]=t*d;
long long ans=inc;
for(int i=1;i<n;i++){
diff[i]=ps[i]-ps[0];
if(mp[diff[i]%d]==0||mp[diff[i]%d]<diff[i]-t*d)ans+=inc;
else ans+inc;
mp[diff[i]%d]=diff[i]+t*d;
}
printf("%lld\n",ans);
return ans;
}
184