Submission #269444

#TimeUsernameProblemLanguageResultExecution timeMemory
269444PKhingDancing Elephants (IOI11_elephants)C++14
26 / 100
9095 ms2944 KiB
#include<bits/stdc++.h> #define FOR(i,a) for(int i=0;i<a;i++) #define FOR1(i,a) for(int i=1;i<=a;i++) #define db(a) printf("<%d> ",a) #define f first #define s second #define all(x) x.begin(),x.end() #define mp make_pair #define pb emplace_back #define p emplace #define iii pair<int,int> #define ll long long #define rf() freopen("_working/input.in","r",stdin) #define pf() freopen("_working/output.out","w+",stdout) using namespace std; const int INF=1e9; #include "elephants.h" int n; int l; int x[150005]; set<iii> s; void init(int N, int L, int X[]) { n = N; l = L; FOR(i,N){ s.p(X[i],i); x[i]=X[i]; } } int update(int i, int y) { if(n>50000) return n; s.erase(mp(x[i],i)); s.insert(mp(y,i)); x[i]=y; int bf = -1; int cnt= 0; for(auto i:s){ //printf(".%d ",i.f); if(bf<i.f){ cnt++; bf = i.f+l; } } //cout<<endl; return cnt; }
#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...