Submission #03599
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #include<bits/stdc++.h> using namespace std; typedef long long int lld; #define INF (1<<20) lld N,T; lld P[1000010]; int solve(lld num){ lld cnt = 0; for (lld i=0;i<N;i++){ if (P[i] > num){ cnt += (P[i] - num + T-1) / T; } } return cnt <= num; } int main(){ cin >> N; lld left = 0,right=0; for (lld i=0;i<N;i++){ cin >> P[i]; right = max(right,P[i]); } cin >> T; T--; if (T == 0){ cout << right << endl; return 0; } while (left < right){ lld mid = (left + right) / 2; if (solve(mid)) right = mid; else left = mid + 1; } cout << left << endl; } |
ステータス
項目 | データ |
---|---|
問題 | 0382 - 「とっぴー」カウンセリング |
ユーザー名 | ei1428 |
投稿日時 | 2016-04-27 18:18:36 |
言語 | C++11 |
状態 | Accepted |
得点 | 5 |
ソースコード長 | 651 Byte |
最大実行時間 | 521 ms |
最大メモリ使用量 | 8204 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 5 / 5 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in1.txt | AC | 11 ms | 472 KB |
1
|
in2.txt | AC | 11 ms | 624 KB |
1
|
in3.txt | AC | 11 ms | 596 KB |
1
|
in4.txt | AC | 12 ms | 568 KB |
1
|
in5.txt | AC | 9 ms | 544 KB |
1
|
in6.txt | AC | 11 ms | 516 KB |
1
|
in7.txt | AC | 14 ms | 484 KB |
1
|
in8.txt | AC | 13 ms | 580 KB |
1
|
in9.txt | AC | 17 ms | 640 KB |
1
|
in10.txt | AC | 18 ms | 832 KB |
1
|
in11.txt | AC | 35 ms | 956 KB |
1
|
in12.txt | AC | 42 ms | 1056 KB |
1
|
in13.txt | AC | 48 ms | 1248 KB |
1
|
in14.txt | AC | 61 ms | 1364 KB |
1
|
in15.txt | AC | 61 ms | 1328 KB |
1
|
in16.txt | AC | 521 ms | 8204 KB |
1
|