結果
| 問題 | No.180 美しいWhitespace (2) |
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2021-11-03 17:56:53 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 790 bytes |
| 記録 | |
| コンパイル時間 | 2,867 ms |
| コンパイル使用メモリ | 275,520 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-23 14:44:04 |
| 合計ジャッジ時間 | 4,461 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 31 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ostream:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/istream:43,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/sstream:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/complex:50,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:141,
from main.cpp:2:
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:8:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:212:25: warning: 'x' may be used uninitialized [-Wmaybe-uninitialized]
212 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:35:19: note: 'x' was declared here
35 | long long x;
| ^
ソースコード
#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 2000000000
int n;
vector<long long> a,b;
long long get(long long x){
long long M = 0,m = 1000000000000000005;
rep(i,n){
M = max(M,a[i]+b[i]*x);
m = min(m,a[i]+b[i]*x);
}
return M-m;
}
int main(){
cin>>n;
a.resize(n),b.resize(n);
rep(i,n)cin>>a[i]>>b[i];
long long l = 1,r = 1000000005;
while(r-l>3){
long long m0 = l + (r-l)/3;
long long m1 = m0 + (r-l)/3;
if(get(m0)<=get(m1))r = m1;
else l = m0;
}
long long ans = 100000000000000000;
long long x;
for(long long i=l;i<=r;i++){
if(ans > get(i)){
x =i;
ans = get(i);
}
}
cout<<x<<endl;
return 0;
}
沙耶花