Submission #133857

#TimeUsernameProblemLanguageResultExecution timeMemory
133857BoxworldDancing Elephants (IOI11_elephants)C++14
26 / 100
20 ms1988 KiB
#include "elephants.h" #include <bits/stdc++.h> using namespace std; struct O{int p,id;}a[110]; int n,l; bool cmp(O x,O y){ return x.p<y.p; } void init(int N, int L, int X[]){ n=N;l=L; for (int i=0;i<N;i++)a[i].p=X[i],a[i].id=i; } int update(int id, int y){ for (int i=0;i<n;i++) if (a[i].id==id)a[i].p=y; sort(a,a+n,cmp); int ans=1,last=a[0].p; for (int i=1;i<n;i++) if (a[i].p-last>l){ last=a[i].p; ans++; } return ans; }
#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...