結果
問題 | No.1251 絶対に間違ってはいけない最小化問題 |
ユーザー | zumin |
提出日時 | 2021-03-24 23:24:20 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,268 bytes |
コンパイル時間 | 1,778 ms |
コンパイル使用メモリ | 83,036 KB |
実行使用メモリ | 160,784 KB |
最終ジャッジ日時 | 2023-08-17 22:43:52 |
合計ジャッジ時間 | 48,475 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 487 ms
157,416 KB |
testcase_01 | AC | 491 ms
157,416 KB |
testcase_02 | AC | 492 ms
157,364 KB |
testcase_03 | AC | 490 ms
157,476 KB |
testcase_04 | AC | 488 ms
157,476 KB |
testcase_05 | AC | 493 ms
157,480 KB |
testcase_06 | AC | 501 ms
157,440 KB |
testcase_07 | AC | 497 ms
157,620 KB |
testcase_08 | AC | 498 ms
157,624 KB |
testcase_09 | AC | 498 ms
157,628 KB |
testcase_10 | AC | 492 ms
157,372 KB |
testcase_11 | AC | 492 ms
157,372 KB |
testcase_12 | AC | 496 ms
157,476 KB |
testcase_13 | AC | 494 ms
157,376 KB |
testcase_14 | AC | 489 ms
157,416 KB |
testcase_15 | AC | 490 ms
157,456 KB |
testcase_16 | AC | 486 ms
157,344 KB |
testcase_17 | AC | 486 ms
157,340 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | RE | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | AC | 492 ms
157,624 KB |
testcase_44 | AC | 498 ms
157,376 KB |
コンパイルメッセージ
次のファイルから読み込み: /usr/local/gcc7/include/c++/12.2.0/iostream:39, 次から読み込み: main.cpp:1: メンバ関数 ‘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:58:11: /usr/local/gcc7/include/c++/12.2.0/ostream:202:25: 警告: ‘minx’ may be used uninitialized [-Wmaybe-uninitialized] 202 | { return _M_insert(__n); } | ~~~~~~~~~^~~~~ main.cpp: 関数 ‘int main()’ 内: main.cpp:49:8: 備考: ‘minx’ はここで定義されています 49 | 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){ if(a>1001001001001001001 || b>1001001001001001001){ return max(a,b); } return a+b; } ll e() {return 0LL;} ll mapping(ll F,ll x) { if(F>1001001001001001001 || x>1001001001001001001){ return max(F,x); } return F+x; } ll composition(ll F,ll G) { if(F>1001001001001001001 || G>1001001001001001001){ return max(F,G); } return F+G; } ll id(){ return 0LL;} int main(){ ll n,dx=2001001,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,3001001,bi); } vector<ll> csum={s.get(0)}; ll fmin=1001001001001; ll minx; for(ll i=0;i<3001001;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; }