Submission #903955

# Submission time Handle Problem Language Result Execution time Memory
903955 2024-01-11T15:29:09 Z Faisal_Saqib Dancing Elephants (IOI11_elephants) C++17
26 / 100
9000 ms 10276 KB
#pragma once 
#include <vector>
#include <algorithm>
#include <iostream>
#include <set>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> sp;
multiset<int> sp;
vector<int> ap;
int cov;
void init(int n, int l, int x[])
{
	cov=l;
	for(int i=0;i<n;i++)
	{
		sp.insert(x[i]);
		ap.push_back(x[i]);
	}
}
int update(int i, int y)
{
	sp.erase(sp.lower_bound(ap[i]));
	ap[i]=y;
	sp.insert(ap[i]);
	int cu=*begin(sp);
	int po=0;
	while(1)
	{
		auto it=(sp.upper_bound(cu+cov));
		po++;
		if(it==sp.end())
			break;
		cu=*it;
	}
	return po;
}

Compilation message

elephants.cpp:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6508 KB Output is correct
2 Correct 1 ms 6504 KB Output is correct
3 Correct 1 ms 6504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6508 KB Output is correct
2 Correct 1 ms 6504 KB Output is correct
3 Correct 1 ms 6504 KB Output is correct
4 Correct 1 ms 6504 KB Output is correct
5 Correct 1 ms 6504 KB Output is correct
6 Correct 1 ms 6504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6508 KB Output is correct
2 Correct 1 ms 6504 KB Output is correct
3 Correct 1 ms 6504 KB Output is correct
4 Correct 1 ms 6504 KB Output is correct
5 Correct 1 ms 6504 KB Output is correct
6 Correct 1 ms 6504 KB Output is correct
7 Execution timed out 9022 ms 10276 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6508 KB Output is correct
2 Correct 1 ms 6504 KB Output is correct
3 Correct 1 ms 6504 KB Output is correct
4 Correct 1 ms 6504 KB Output is correct
5 Correct 1 ms 6504 KB Output is correct
6 Correct 1 ms 6504 KB Output is correct
7 Execution timed out 9022 ms 10276 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6508 KB Output is correct
2 Correct 1 ms 6504 KB Output is correct
3 Correct 1 ms 6504 KB Output is correct
4 Correct 1 ms 6504 KB Output is correct
5 Correct 1 ms 6504 KB Output is correct
6 Correct 1 ms 6504 KB Output is correct
7 Execution timed out 9022 ms 10276 KB Time limit exceeded
8 Halted 0 ms 0 KB -