-
Notifications
You must be signed in to change notification settings - Fork 163
提出 二分探索 #139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
提出 二分探索 #139
Conversation
nanashima
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apple.c spear.c works.c が正しく動いていません.
src/apple.c
Outdated
| for(int j = 0; j < n; j++){ | ||
| sum += A[j]; | ||
| } | ||
| return sum; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
初期値が大きすぎて,最悪桁あふれします.改善してください.
src/spear.c
Outdated
| for(int j = 0; j < n; j++){ | ||
| sum += A[j]; | ||
| } | ||
| return sum; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここもです.
| } | ||
|
|
||
| //人の入れ替わりがk-1回起こるようにする | ||
| int p(int m){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
原因までは特定してないですが,資料中のケースでも正しく動いていないのでは?
|
二分探索 再提出 |
nanashima
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spearは境界値で正しい答えを返しません.
worksはほとんどのランダムケースで正しい答えを返していないです.(大きめの解を出しています)
src/spear.c
Outdated
|
|
||
|
|
||
| lb = 0; | ||
| ub = m(A); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
初期値が不適切です.
src/works.c
Outdated
| int people = 1; | ||
| for(int a = 0; a < n-1; a++){ | ||
| if(A[a] + A[a+1] <= m){ | ||
| A[a+1] = A[a] + A[a+1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aに直接操作するのはあまり良い方法ではないです.
何度もpを呼ぶわけなので.
No description provided.