Submission #15748

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
157482015-07-19 11:59:27conankunSplit the sequence (APIO14_sequence)C++98
0 / 100
0 ms92424 KiB
#include<iostream>
#include<vector>
#include<algorithm>
typedef long long ll;
using namespace std;
ll S[111111];
ll D[2][111111];
int bt[202][111111];
int N, K;
long double g(int k, int a, int b) {
return (long double)(D[1-k][b] - D[1-k][a] - S[b] * S[b] + S[a] * S[a]) / (S[a]-S[b]);
}
inline ll max(ll a, ll b) {
if (a > b) return a;
return b;
}
int qu[111111];
int main() {
cin.sync_with_stdio(false);
cin >> N >> K;
int i,j, k;
for (i = 1; i <= N; i++) {
cin >> S[i];
S[i] += S[i - 1];
}
for (k = 1; k <= K; k++) {
int s = 0, e = 0;
for (i = 1; i <= N; i++) {
for (j = s; j <= e-1; j++) {
if (g(k%2, qu[j], qu[j + 1]) < S[i]) s++;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...