Submission #919943

# Submission time Handle Problem Language Result Execution time Memory
919943 2024-02-01T22:38:03 Z Lalic Dancing Elephants (IOI11_elephants) C++17
26 / 100
9000 ms 10748 KB
#include <bits/stdc++.h>
#include "elephants.h"
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 15e4+10;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9+7;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

vector<pii> arr;
int l;

void init(int N, int L, int X[])
{
	arr.resize(N);
	for(int i=0;i<N;i++) arr[i]={X[i], i};
	l=L;
}

int update(int i, int y)
{
	vector<pii> proc;
	bool b=0;
	for(int j=0;j<(int)arr.size();j++){
		if(arr[j].se==i) continue;
		if(!b && arr[j].fi>=y){
			proc.pb({y, i});
			b=1;
		}
		proc.pb(arr[j]);
	}
	if(!b) proc.pb({y, i});
	arr=proc;
	
	int curr=-l-1, ans=0;
	for(auto u : arr){
		if(u.fi<=curr+l) continue;
		curr=u.fi;
		ans++;
	}
	
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 1 ms 6644 KB Output is correct
3 Correct 2 ms 6488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 1 ms 6644 KB Output is correct
3 Correct 2 ms 6488 KB Output is correct
4 Correct 2 ms 6488 KB Output is correct
5 Correct 1 ms 6488 KB Output is correct
6 Correct 1 ms 6488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 1 ms 6644 KB Output is correct
3 Correct 2 ms 6488 KB Output is correct
4 Correct 2 ms 6488 KB Output is correct
5 Correct 1 ms 6488 KB Output is correct
6 Correct 1 ms 6488 KB Output is correct
7 Correct 4261 ms 9576 KB Output is correct
8 Correct 8237 ms 9720 KB Output is correct
9 Execution timed out 9049 ms 10748 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 1 ms 6644 KB Output is correct
3 Correct 2 ms 6488 KB Output is correct
4 Correct 2 ms 6488 KB Output is correct
5 Correct 1 ms 6488 KB Output is correct
6 Correct 1 ms 6488 KB Output is correct
7 Correct 4261 ms 9576 KB Output is correct
8 Correct 8237 ms 9720 KB Output is correct
9 Execution timed out 9049 ms 10748 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 1 ms 6644 KB Output is correct
3 Correct 2 ms 6488 KB Output is correct
4 Correct 2 ms 6488 KB Output is correct
5 Correct 1 ms 6488 KB Output is correct
6 Correct 1 ms 6488 KB Output is correct
7 Correct 4261 ms 9576 KB Output is correct
8 Correct 8237 ms 9720 KB Output is correct
9 Execution timed out 9049 ms 10748 KB Time limit exceeded
10 Halted 0 ms 0 KB -