제출 #350004

#제출 시각아이디문제언어결과실행 시간메모리
350004idk321코끼리 (Dancing Elephants) (IOI11_elephants)C++11
26 / 100
9086 ms3436 KiB
#include "elephants.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 50000; int pos[N]; int x[N]; int n; set<int> val; int l; void init(int N, int L, int X[]) { n = N; l = L; for (int i = 0; i < n; i++) x[i] = X[i]; for (int i = 0; i < n; i++) { pos[i] = x[i]; } } int update(int ind, int y) { int nx[N]; bool added = false; int curr = 0; for (int i = 0; i < n; i++) { if (x[i] == pos[ind]) continue; if (x[i] > y && !added) { nx[curr] = y; added = true; curr++; } nx[curr] = x[i]; curr++; } if (!added) nx[curr] = y; swap(x, nx); int last = -1; int res = 0; pos[ind] = y; for(int i = 0; i < n; i++) { if (x[i] > last) { last = x[i] + l; res++; } } return res; }
#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...