提出 #75673447
ソースコード 拡げる
#include <bits/stdc++.h>
using namespace std;
int64_t N;
int64_t K;
vector<int64_t> A(200005);
bool search(int64_t x) {
int64_t ans = 0;
int64_t cur = K;
for (int64_t i = 0; i < N; i++) {
ans = 0;
double TTT = (x-A.at(i))/(i+1.00000);
int64_t XX = ceil(TTT);
if (XX > 0) {
ans = XX;
}
else {
ans = 0;
}
cur -= ans;
if (cur < 0) {
return false;
}
}
return true;
}
int main() {
cin >> N;
cin >> K;
for (int64_t i = 0; i < N; i++) {
cin >> A.at(i);
}
// binary_search
int64_t left = 0;
int64_t right = A.at(0)+K+1;
int64_t middle;
while (right - left > 1) {
middle = (right - left) / 2 + left;
if (search(middle)) {
left = middle;
}
else {
right = middle;
}
if (search(middle) && !search(middle+1)) {
cout << middle << endl;
goto END;
}
}
cout << middle << endl;
END:
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | D - Raise Minimum |
| ユーザ | KOJIKEE |
| 言語 | C++23 (GCC 15.2.0) |
| 得点 | 0 |
| コード長 | 999 Byte |
| 結果 | WA |
| 実行時間 | 114 ms |
| メモリ | 5052 KiB |
コンパイルエラー
In member function 'operator<<',
inlined from 'main' at ./Main.cpp:50:11:
/opt/atcoder/gcc/include/c++/15.2.0/bits/ostream.h:175:25: warning: 'middle' may be used uninitialized [-Wmaybe-uninitialized]
175 | { return _M_insert(__n); }
| ^
./Main.cpp: In function 'main':
./Main.cpp:36:11: note: 'middle' was declared here
36 | int64_t middle;
| ^
ジャッジ結果
| セット名 | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 0 / 400 | ||||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_corner_00.txt, 01_corner_01.txt, 01_corner_02.txt, 01_corner_03.txt, 01_corner_04.txt, 01_corner_05.txt, 01_corner_06.txt, 01_corner_07.txt, 01_corner_08.txt, 01_corner_09.txt, 01_corner_10.txt, 02_hack_00.txt, 02_hack_01.txt, 02_hack_02.txt, 02_hack_03.txt, 02_hack_04.txt, 02_hack_05.txt, 02_hack_06.txt, 02_hack_07.txt, 02_hack_08.txt, 02_hack_09.txt, 02_hack_10.txt, 02_hack_11.txt, 02_hack_12.txt, 03_random_00.txt, 03_random_01.txt, 03_random_02.txt, 03_random_03.txt, 03_random_04.txt, 03_random_05.txt, 03_random_06.txt, 03_random_07.txt, 03_random_08.txt, 03_random_09.txt, 03_random_10.txt, 03_random_11.txt, 03_random_12.txt, 03_random_13.txt, 03_random_14.txt, 03_random_15.txt, 03_random_16.txt, 03_random_17.txt, 03_random_18.txt, 03_random_19.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 00_sample_00.txt | AC | 2 ms | 4740 KiB |
| 00_sample_01.txt | AC | 2 ms | 4732 KiB |
| 00_sample_02.txt | AC | 2 ms | 4868 KiB |
| 01_corner_00.txt | AC | 2 ms | 4732 KiB |
| 01_corner_01.txt | AC | 19 ms | 5052 KiB |
| 01_corner_02.txt | AC | 2 ms | 4792 KiB |
| 01_corner_03.txt | WA | 111 ms | 4740 KiB |
| 01_corner_04.txt | WA | 41 ms | 4868 KiB |
| 01_corner_05.txt | WA | 44 ms | 4980 KiB |
| 01_corner_06.txt | AC | 51 ms | 4868 KiB |
| 01_corner_07.txt | WA | 50 ms | 4768 KiB |
| 01_corner_08.txt | WA | 54 ms | 4996 KiB |
| 01_corner_09.txt | AC | 51 ms | 5052 KiB |
| 01_corner_10.txt | WA | 51 ms | 4940 KiB |
| 02_hack_00.txt | AC | 2 ms | 4740 KiB |
| 02_hack_01.txt | WA | 2 ms | 4852 KiB |
| 02_hack_02.txt | AC | 2 ms | 4940 KiB |
| 02_hack_03.txt | WA | 2 ms | 5004 KiB |
| 02_hack_04.txt | AC | 20 ms | 4920 KiB |
| 02_hack_05.txt | AC | 22 ms | 4868 KiB |
| 02_hack_06.txt | AC | 7 ms | 4808 KiB |
| 02_hack_07.txt | AC | 46 ms | 4940 KiB |
| 02_hack_08.txt | AC | 62 ms | 4868 KiB |
| 02_hack_09.txt | AC | 25 ms | 4860 KiB |
| 02_hack_10.txt | AC | 86 ms | 4796 KiB |
| 02_hack_11.txt | AC | 32 ms | 4924 KiB |
| 02_hack_12.txt | WA | 37 ms | 4940 KiB |
| 03_random_00.txt | WA | 111 ms | 4792 KiB |
| 03_random_01.txt | WA | 102 ms | 4876 KiB |
| 03_random_02.txt | WA | 111 ms | 4804 KiB |
| 03_random_03.txt | WA | 20 ms | 4744 KiB |
| 03_random_04.txt | WA | 113 ms | 4852 KiB |
| 03_random_05.txt | WA | 56 ms | 4804 KiB |
| 03_random_06.txt | WA | 112 ms | 4848 KiB |
| 03_random_07.txt | WA | 7 ms | 4740 KiB |
| 03_random_08.txt | WA | 112 ms | 4740 KiB |
| 03_random_09.txt | WA | 27 ms | 4812 KiB |
| 03_random_10.txt | AC | 110 ms | 4852 KiB |
| 03_random_11.txt | WA | 40 ms | 4812 KiB |
| 03_random_12.txt | WA | 114 ms | 4860 KiB |
| 03_random_13.txt | WA | 63 ms | 4924 KiB |
| 03_random_14.txt | WA | 110 ms | 4792 KiB |
| 03_random_15.txt | WA | 61 ms | 4876 KiB |
| 03_random_16.txt | WA | 113 ms | 4868 KiB |
| 03_random_17.txt | WA | 111 ms | 4812 KiB |
| 03_random_18.txt | WA | 112 ms | 4876 KiB |
| 03_random_19.txt | WA | 113 ms | 4932 KiB |