Submission #655686

# Submission time Handle Problem Language Result Execution time Memory
655686 2022-11-05T09:56:48 Z ShirAriel Walking (NOI12_walking) C++17
25 / 25
1 ms 276 KB
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>

using namespace std;

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

bool comp(pll val1, pll val2)
{
	return val1.first > val2.first;
}

int main()
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

	ll l, n;
	cin >> l >> n;

	vector<pll> persons(n);
	for (ll i = 0; i < n; i++)
		cin >> persons[i].first >> persons[i].second;

	sort(persons.begin(), persons.end(), comp);

	//lis
	set<double> lis;
	for (ll i = 0; i < n; i++)
	{
		double val = l / (double)persons[i].second + persons[i].first;
		auto it = lis.lower_bound(val);
		if (it != lis.end())
			lis.erase(it);
		lis.insert(val);
	}

	cout << lis.size();

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 276 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct