# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
764338 | 2023-06-23T10:48:17 Z | boris_mihov | 코끼리 (Dancing Elephants) (IOI11_elephants) | C++17 | 9000 ms | 2132 KB |
#include "elephants.h" #include <algorithm> #include <iostream> #include <numeric> #include <cassert> #include <random> #include <vector> #include <set> typedef long long llong; const int MAXN = 150000 + 10; const int INF = 2e9; int n, len; int a[MAXN]; int x[MAXN]; void init(int N, int L, int X[]) { n = N; len = L; for (int i = 0 ; i < n ; ++i) { a[i + 1] = x[i + 1] = X[i]; } } int update(int idx, int y) { idx++; int pos; for (int i = 1 ; i <= n ; ++i) { if (a[i] == x[idx]) { a[i] = y; pos = i; break; } } x[idx] = y; idx = pos; while (idx > 1 && a[idx - 1] > a[idx]) { std::swap(a[idx - 1], a[idx]); idx--; } while (idx < n && a[idx + 1] < a[idx]) { std::swap(a[idx], a[idx + 1]); idx++; } std::sort(a + 1, a + 1 + n); int coveredTo = -1, ans = 0; for (int i = 1 ; i <= n ; ++i) { if (coveredTo < a[i]) { ans++; coveredTo = a[i] + len; } } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 304 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 304 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 7100 ms | 1956 KB | Output is correct |
8 | Execution timed out | 9097 ms | 2132 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 304 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 7100 ms | 1956 KB | Output is correct |
8 | Execution timed out | 9097 ms | 2132 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 304 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 7100 ms | 1956 KB | Output is correct |
8 | Execution timed out | 9097 ms | 2132 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |