제출 #1241020

#제출 시각아이디문제언어결과실행 시간메모리
1241020candi_ositos코끼리 (Dancing Elephants) (IOI11_elephants)C++20
50 / 100
9091 ms1620 KiB
#include "elephants.h" #include <bits/stdc++.h> using namespace std; int n; vector <int> ap; vector <int> pe; int c; void init(int N, int L, int X[]){ n=N; c=L; ap.resize(n); pe.resize(n); for(int i=0; i<n; ++i){ pe[i]=X[i]; ap[i]=X[i]; } sort(pe.begin(), pe.end()); } int update(int i, int y){ int cnt=0; for(int j=0; j<n; ++j){ if(pe[j]==ap[i]){ pe.erase(pe.begin()+j, pe.begin()+j+1); break; } } ap[i]=y; pe.push_back(y); for(int j=n-2; j>=0; --j){ if(pe[j]>y){ pe[j+1]=pe[j]; pe[j]=y; } else if(pe[j]<=y){ break; } } int cp=-1; for(int j=0; j<n; ++j){ if(cp==-1 || cp+c<pe[j]){ ++cnt; cp=pe[j]; } } 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...