結果
| 問題 |
No.489 株に挑戦
|
| ユーザー |
vjudge1
|
| 提出日時 | 2025-01-26 10:42:22 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 524 bytes |
| コンパイル時間 | 3,646 ms |
| コンパイル使用メモリ | 273,612 KB |
| 実行使用メモリ | 13,632 KB |
| 最終ジャッジ日時 | 2025-01-26 10:42:30 |
| 合計ジャッジ時間 | 6,945 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 WA * 29 TLE * 1 |
コンパイルメッセージ
In file included from /usr/include/c++/13/bits/unique_ptr.h:42,
from /usr/include/c++/13/memory:78,
from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:56,
from main.cpp:1:
In member function ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]’,
inlined from ‘int main()’ at main.cpp:25:20:
/usr/include/c++/13/ostream:204:25: warning: ‘I’ may be used uninitialized [-Wmaybe-uninitialized]
204 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function ‘int main()’:
main.cpp:18:17: note: ‘I’ was declared here
18 | ll mx=0,I,J;
| ^
In member function ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]’,
inlined from ‘int main()’ at main.cpp:25:28:
/usr/include/c++/13/ostream:204:25: warning: ‘J’ may be used uninitialized [-Wmaybe-uninitialized]
204 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function ‘int main()’:
main.cpp:18:19: note: ‘J’ was declared here
18 | ll mx=0,I,J;
| ^
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,d,k,cnt=0,mx=0;
pair<ll,ll> a[100005];
int main(){
// freopen("stock.in","r",stdin);
// freopen("stock.out","w",stdout);
cin>>n>>d>>k;
for(int i=0,p;i<n;i++){
cin>>p;
if(p>mx)mx=p,a[cnt++]={i,p};
}
if(cnt==1){
cout<<0;
return 0;
}
ll mx=0,I,J;
for(int i=0;i<cnt;i++){
for(int j=i+1;a[j].first-a[i].first<=d&&j<cnt;j++){
ll x=a[j].second-a[i].second;
if(x>mx)mx=x,I=a[i].first,J=a[j].first;
}
}
cout<<mx*k<<endl<<I<<" "<<J;
}
vjudge1