답안 #799926

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
799926 2023-08-01T08:28:08 Z Sohsoh84 코끼리 (Dancing Elephants) (IOI11_elephants) C++17
50 / 100
9000 ms 1796 KB
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("O3")

#include "elephants.h"
#include <bits/stdc++.h>

#pragma GCC target("avx2")

using namespace std;

const int MAXN = 70000 + 10;

int X[MAXN], n, L;
vector<int> vec; // TODO: multiset

void init(int N, int L_, int X_[]) {
	L = L_;
	for (int i = 0; i < N; i++) {
		X[i] = X_[i];	
		vec.push_back(X[i]);
	}

	n = N;
}

int update(int i, int y) {
	vec.erase(lower_bound(vec.begin(), vec.end(), X[i]));
	X[i] = y;
	vec.insert(lower_bound(vec.begin(), vec.end(), X[i]), X[i]);

	int ans = 0;
	int v = -(L + 1);
	
	for (int i = 0; i < n; i++) {
		if (vec[i] > v + L) {
			v = vec[i];
			ans++;
		}	
	}
	
	return ans;
}
# 결과 실행 시간 메모리 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 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 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 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 423 ms 1120 KB Output is correct
8 Correct 613 ms 1236 KB Output is correct
9 Correct 1077 ms 1620 KB Output is correct
10 Correct 1234 ms 1652 KB Output is correct
11 Correct 1158 ms 1620 KB Output is correct
12 Correct 4600 ms 1620 KB Output is correct
13 Correct 1387 ms 1560 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 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 423 ms 1120 KB Output is correct
8 Correct 613 ms 1236 KB Output is correct
9 Correct 1077 ms 1620 KB Output is correct
10 Correct 1234 ms 1652 KB Output is correct
11 Correct 1158 ms 1620 KB Output is correct
12 Correct 4600 ms 1620 KB Output is correct
13 Correct 1387 ms 1560 KB Output is correct
14 Correct 837 ms 1428 KB Output is correct
15 Correct 1206 ms 1516 KB Output is correct
16 Execution timed out 9075 ms 1796 KB Time limit exceeded
17 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 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 423 ms 1120 KB Output is correct
8 Correct 613 ms 1236 KB Output is correct
9 Correct 1077 ms 1620 KB Output is correct
10 Correct 1234 ms 1652 KB Output is correct
11 Correct 1158 ms 1620 KB Output is correct
12 Correct 4600 ms 1620 KB Output is correct
13 Correct 1387 ms 1560 KB Output is correct
14 Correct 837 ms 1428 KB Output is correct
15 Correct 1206 ms 1516 KB Output is correct
16 Execution timed out 9075 ms 1796 KB Time limit exceeded
17 Halted 0 ms 0 KB -