Submission #51141

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
511412018-06-16 16:19:38imeimi2000Dancing Elephants (IOI11_elephants)C++17
100 / 100
3127 ms78636 KiB
#include "elephants.h"
#include <algorithm>
#include <map>
using namespace std;
const int t = 500;
const int MAXN = 2e5;
int n, l, a[MAXN];
int x[MAXN];
int bs;
map<int, int> mp;
struct _dp {
int cnt, mx;
_dp operator+(int x) const {
return { cnt + x, mx };
}
} dp[t][t << 1 | 1];
int buc[t][t << 1 | 1];
int s[t];
const int inf = 1e9 + 7;
void recalc(int s) {
int j = buc[s][0];
for (int i = j++; i > 0; --i) {
while (j > 1 && buc[s][i] + l < buc[s][j - 1]) --j;
if (j <= buc[s][0]) dp[s][i] = dp[s][j] + 1;
else dp[s][i] = { 1, buc[s][i] };
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...