답안 #799918

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
799918 2023-08-01T08:21:38 Z Sohsoh84 코끼리 (Dancing Elephants) (IOI11_elephants) C++17
26 / 100
9000 ms 5292 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 = 50000 + 10;

int X[MAXN], n, L;
set<int> st; // TODO: multiset

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

	n = N;
}

int update(int i, int y) {
	st.erase(X[i]);
	X[i] = y;
	st.insert(X[i]);

	int ans = 0;
	int v = -(L + 1);
	
	for (int e : st) {
		if (e > v + L) {
			v = e;
			ans++;
		}	
	}
	
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 308 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 308 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 308 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 4054 ms 2236 KB Output is correct
8 Correct 6124 ms 2876 KB Output is correct
9 Execution timed out 9071 ms 5292 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 308 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 4054 ms 2236 KB Output is correct
8 Correct 6124 ms 2876 KB Output is correct
9 Execution timed out 9071 ms 5292 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 308 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 4054 ms 2236 KB Output is correct
8 Correct 6124 ms 2876 KB Output is correct
9 Execution timed out 9071 ms 5292 KB Time limit exceeded
10 Halted 0 ms 0 KB -