結果
問題 | No.2221 Set X |
ユーザー | karinohito |
提出日時 | 2023-02-17 23:39:30 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 166 ms / 2,000 ms |
コード長 | 481 bytes |
コンパイル時間 | 2,018 ms |
コンパイル使用メモリ | 202,580 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 14:49:18 |
合計ジャッジ時間 | 5,947 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 1 ms
5,376 KB |
testcase_03 | AC | 1 ms
5,376 KB |
testcase_04 | AC | 2 ms
5,376 KB |
testcase_05 | AC | 1 ms
5,376 KB |
testcase_06 | AC | 1 ms
5,376 KB |
testcase_07 | AC | 1 ms
5,376 KB |
testcase_08 | AC | 1 ms
5,376 KB |
testcase_09 | AC | 1 ms
5,376 KB |
testcase_10 | AC | 2 ms
5,376 KB |
testcase_11 | AC | 2 ms
5,376 KB |
testcase_12 | AC | 2 ms
5,376 KB |
testcase_13 | AC | 2 ms
5,376 KB |
testcase_14 | AC | 2 ms
5,376 KB |
testcase_15 | AC | 2 ms
5,376 KB |
testcase_16 | AC | 59 ms
5,376 KB |
testcase_17 | AC | 22 ms
5,376 KB |
testcase_18 | AC | 68 ms
5,376 KB |
testcase_19 | AC | 19 ms
5,376 KB |
testcase_20 | AC | 41 ms
5,376 KB |
testcase_21 | AC | 66 ms
5,376 KB |
testcase_22 | AC | 91 ms
5,376 KB |
testcase_23 | AC | 6 ms
5,376 KB |
testcase_24 | AC | 61 ms
5,376 KB |
testcase_25 | AC | 39 ms
5,376 KB |
testcase_26 | AC | 136 ms
5,376 KB |
testcase_27 | AC | 157 ms
5,376 KB |
testcase_28 | AC | 166 ms
5,376 KB |
testcase_29 | AC | 125 ms
5,376 KB |
testcase_30 | AC | 133 ms
5,376 KB |
testcase_31 | AC | 154 ms
5,376 KB |
testcase_32 | AC | 111 ms
5,376 KB |
testcase_33 | AC | 118 ms
5,376 KB |
testcase_34 | AC | 109 ms
5,376 KB |
testcase_35 | AC | 111 ms
5,376 KB |
testcase_36 | AC | 124 ms
5,376 KB |
testcase_37 | AC | 130 ms
5,376 KB |
testcase_38 | AC | 125 ms
5,376 KB |
testcase_39 | AC | 129 ms
5,376 KB |
testcase_40 | AC | 146 ms
5,376 KB |
testcase_41 | AC | 136 ms
5,376 KB |
testcase_42 | AC | 141 ms
5,376 KB |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/istream:39, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/sstream:38, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/complex:45, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ccomplex:39, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/x86_64-pc-linux-gnu/bits/stdc++.h:54, 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:20:11: /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ostream:202:25: warning: 'x' may be used uninitialized [-Wmaybe-uninitialized] 202 | { return _M_insert(__n); } | ~~~~~~~~~^~~~~ main.cpp: In function 'int main()': main.cpp:5:17: note: 'x' was declared here 5 | ll N,an=1e9,x; | ^
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll N,an=1e9,x; cin>>N; vector<ll> A(N); for(ll &a:A)cin>>a; for(ll i=1;i<=2*N;i++){ ll res=0,L=0; while(1){ auto p=lower_bound(A.begin(),A.end(),L*i); if(p==A.end())break; res++; L=(*p/i)+1; if(res*(i+1)>=an)break; } if(an>res*(i+1))an=res*(i+1),x=i; } cout<<x<<endl<<an<<endl; }