# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
764342 | 2023-06-23T10:48:59 Z | boris_mihov | 코끼리 (Dancing Elephants) (IOI11_elephants) | C++17 | 9000 ms | 1056 KB |
#include "elephants.h" #include <algorithm> #include <iostream> #include <numeric> #include <cassert> #include <random> #include <vector> #include <set> #pragma GCC optimize ("O3") #pragma GCC target ("sse4") 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 | 0 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 0 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 0 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 7514 ms | 1056 KB | Output is correct |
8 | Execution timed out | 9041 ms | 1016 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 0 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 7514 ms | 1056 KB | Output is correct |
8 | Execution timed out | 9041 ms | 1016 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 0 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 7514 ms | 1056 KB | Output is correct |
8 | Execution timed out | 9041 ms | 1016 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |