# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
8092 |
2014-08-29T16:30:25 Z |
gs14004 |
전봇대 (KOI13_pole) |
C++ |
|
0 ms |
1088 KB |
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long lint;
struct pole{lint a,i;}d[105];
int cmp(pole a, pole b){return a.a * b.i < b.a * a.i;}
lint n;
lint trial(lint piv){
lint res = 0;
for (int i=0; i<n; i++) {
res += max(d[i].a - piv * d[i].i, piv * d[i].i - d[i].a);
}
return res;
}
int main(){
scanf("%lld",&n);
for (int i=0; i<n; i++) {
scanf("%lld",&d[i].a);
d[i].i = i;
}
sort(d,d+n,cmp);
int piv;
lint cum = 0;
for (piv = 0; piv < n; piv++) {
cum += d[piv].i;
if(cum >= n * (n-1) / 4) break;
}
lint that = d[piv].a / d[piv].i;
printf("%lld",min(trial(that),trial(that+1)));
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1088 KB |
Output is correct |
2 |
Correct |
0 ms |
1088 KB |
Output is correct |
3 |
Incorrect |
0 ms |
1088 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1088 KB |
Output is correct |
2 |
Correct |
0 ms |
1088 KB |
Output is correct |
3 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
1084 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
1084 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
2 |
Halted |
0 ms |
0 KB |
- |