Submission #345760

#TimeUsernameProblemLanguageResultExecution timeMemory
345760casperwang코끼리 (Dancing Elephants) (IOI11_elephants)C++14
26 / 100
9039 ms1132 KiB
#include "elephants.h" #include <bits/stdc++.h> #define All(x) x.begin(), x.end() #define pii pair<int,int> #define ff first #define ss second using namespace std; #define debug(args...) kout("[ " + string(#args) + " ]", args) void kout() { cerr << endl; } template <class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ',kout(b...); } template <class T> void pary(T L, T R) { while (L != R) cerr << *L << " \n"[++L==R]; } const int MAXN = 150000; int n, len; set <pii> now; map <int,int> pts; vector <int> a; int ans; void init(int N, int L, int X[]) { n = N, len = L + 1; ans = 0; now.clear(); a.clear(), a.resize(N); for (int i = 0; i < n; i++) a[i] = X[i]; } int solve(vector <int> arr) { sort(All(arr)); int st = arr[0], cnt = 0; for (int i = 1; i < n; i++) { if (arr[i] - st >= len) { cnt += (arr[i-1] - st + 1 + len-1) / len; st = arr[i]; } } cnt += (arr[n-1] - st + 1 + len-1) / len; return cnt; } int update(int i, int y) { a[i] = y; return solve(a); }
#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...