# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
8097 |
2014-08-29T16:58:18 Z |
gs14004 |
전봇대 (KOI13_pole) |
C++ |
|
32 ms |
1868 KB |
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long lint;
lint d[100005];
int n;
lint trial(lint piv){
lint res = 0;
for (int i=0; i<n; i++) {
res += max(d[i] - piv * i, piv * i - d[i]);
}
return res;
}
int main(){
scanf("%d",&n);
for (int i=0; i<n; i++) {
scanf("%lld",&d[i]);
}
int s = 0, e = 1e9;
while (s != e) {
int m = (s+e)>>1;
if(trial(m) > trial(m+1)) s = m+1;
else e = m;
}
printf("%lld",trial(s));
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1868 KB |
Output is correct |
2 |
Correct |
0 ms |
1868 KB |
Output is correct |
3 |
Correct |
0 ms |
1868 KB |
Output is correct |
4 |
Correct |
0 ms |
1868 KB |
Output is correct |
5 |
Correct |
0 ms |
1868 KB |
Output is correct |
6 |
Correct |
0 ms |
1868 KB |
Output is correct |
7 |
Correct |
0 ms |
1868 KB |
Output is correct |
8 |
Correct |
0 ms |
1868 KB |
Output is correct |
9 |
Correct |
0 ms |
1868 KB |
Output is correct |
10 |
Correct |
0 ms |
1868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1868 KB |
Output is correct |
2 |
Correct |
0 ms |
1868 KB |
Output is correct |
3 |
Correct |
0 ms |
1868 KB |
Output is correct |
4 |
Correct |
0 ms |
1868 KB |
Output is correct |
5 |
Correct |
0 ms |
1868 KB |
Output is correct |
6 |
Correct |
0 ms |
1868 KB |
Output is correct |
7 |
Correct |
0 ms |
1868 KB |
Output is correct |
8 |
Correct |
0 ms |
1868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1868 KB |
Output is correct |
2 |
Correct |
0 ms |
1868 KB |
Output is correct |
3 |
Correct |
0 ms |
1868 KB |
Output is correct |
4 |
Correct |
4 ms |
1868 KB |
Output is correct |
5 |
Correct |
0 ms |
1868 KB |
Output is correct |
6 |
Correct |
0 ms |
1868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
1868 KB |
Output is correct |
2 |
Correct |
28 ms |
1868 KB |
Output is correct |
3 |
Correct |
28 ms |
1868 KB |
Output is correct |
4 |
Correct |
28 ms |
1868 KB |
Output is correct |
5 |
Correct |
32 ms |
1868 KB |
Output is correct |
6 |
Correct |
24 ms |
1868 KB |
Output is correct |