結果
問題 | No.1251 絶対に間違ってはいけない最小化問題 |
ユーザー | zumin |
提出日時 | 2021-03-24 23:36:12 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 996 bytes |
コンパイル時間 | 780 ms |
コンパイル使用メモリ | 83,724 KB |
実行使用メモリ | 136,844 KB |
最終ジャッジ日時 | 2024-05-05 05:32:06 |
合計ジャッジ時間 | 30,979 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 261 ms
133,588 KB |
testcase_01 | AC | 251 ms
133,712 KB |
testcase_02 | AC | 257 ms
133,580 KB |
testcase_03 | AC | 255 ms
133,708 KB |
testcase_04 | AC | 254 ms
133,584 KB |
testcase_05 | AC | 254 ms
133,712 KB |
testcase_06 | AC | 255 ms
133,716 KB |
testcase_07 | AC | 258 ms
133,588 KB |
testcase_08 | AC | 260 ms
133,588 KB |
testcase_09 | AC | 255 ms
133,712 KB |
testcase_10 | AC | 258 ms
133,584 KB |
testcase_11 | AC | 252 ms
133,716 KB |
testcase_12 | AC | 255 ms
133,588 KB |
testcase_13 | AC | 259 ms
133,720 KB |
testcase_14 | AC | 258 ms
133,712 KB |
testcase_15 | AC | 255 ms
133,712 KB |
testcase_16 | AC | 255 ms
133,588 KB |
testcase_17 | AC | 252 ms
133,588 KB |
testcase_18 | AC | 639 ms
136,704 KB |
testcase_19 | AC | 630 ms
136,476 KB |
testcase_20 | AC | 468 ms
135,228 KB |
testcase_21 | AC | 291 ms
133,956 KB |
testcase_22 | AC | 484 ms
135,508 KB |
testcase_23 | AC | 291 ms
133,760 KB |
testcase_24 | AC | 641 ms
136,076 KB |
testcase_25 | AC | 479 ms
135,308 KB |
testcase_26 | AC | 336 ms
134,464 KB |
testcase_27 | AC | 307 ms
133,896 KB |
testcase_28 | AC | 680 ms
136,836 KB |
testcase_29 | AC | 660 ms
136,712 KB |
testcase_30 | AC | 648 ms
136,840 KB |
testcase_31 | AC | 687 ms
136,712 KB |
testcase_32 | AC | 653 ms
136,840 KB |
testcase_33 | AC | 670 ms
136,836 KB |
testcase_34 | AC | 665 ms
136,840 KB |
testcase_35 | AC | 668 ms
136,712 KB |
testcase_36 | AC | 650 ms
136,840 KB |
testcase_37 | RE | - |
testcase_38 | AC | 693 ms
136,712 KB |
testcase_39 | AC | 674 ms
136,708 KB |
testcase_40 | AC | 665 ms
136,844 KB |
testcase_41 | AC | 681 ms
136,840 KB |
testcase_42 | AC | 660 ms
136,840 KB |
testcase_43 | AC | 266 ms
133,716 KB |
testcase_44 | AC | 261 ms
133,616 KB |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/iostream:39, 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:43:11: /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ostream:202:25: warning: 'minx' may be used uninitialized [-Wmaybe-uninitialized] 202 | { return _M_insert(__n); } | ~~~~~~~~~^~~~~ main.cpp: In function 'int main()': main.cpp:34:8: note: 'minx' was declared here 34 | ll minx; | ^~~~
ソースコード
#include <iostream> #include <vector> #include <map> #include <atcoder/lazysegtree> using namespace std; using namespace atcoder; using ll=long long; ll op(ll a,ll b) {return a+b;} ll e() {return 0LL;} ll mapping(ll F,ll x) {return F+x;} ll composition(ll F,ll G) {return F+G;} ll id(){ return 0LL;} int main(){ ll n,dx=1000001,ans=0; cin>>n; vector<ll> a(n),b(n); lazy_segtree<ll,op,e,ll,mapping,composition,id> s(3001002); for(int i=0;i<n;i++) {cin>>a[i];a[i]+=dx;} for(int i=0;i<n;i++) cin>>b[i]; for(int i=0;i<n;i++){ ll ai=a[i],bi=b[i]; s.apply(0,bi*ai); s.apply(1,ai+1,-bi); s.apply(ai+1,2000001,bi); } vector<ll> csum={s.get(0)}; ll fmin=1001001001001001001; ll minx; for(ll i=0;i<2000000;i++){ csum.push_back(csum[i]+s.get(i+1)); ll f=csum[i+1]; if(f<fmin){ fmin=f; minx=i+1-dx; } } cout<<minx<<" "<<fmin<<endl; return 0; }