# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
731831 | maeola | Walking (NOI12_walking) | C++17 | 2 ms | 316 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// trans rights
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int L, N;
int U[505];
int main(int argc, const char *argv[])
{
scanf(" %d %d", &L, &N);
vector<pair<int, int>> ac;
for (int i = 0; i < N; i++)
{
int t, v;
scanf(" %d %d", &t, &v);
ac.push_back({t, v});
}
sort(ac.begin(), ac.end());
int ans = 0;
for (int i = 0; i < N; i++)
{
int g = 0;
for (int j = 0; j < i; j++)
{
if (L * ac[i].second +
ac[j].first * ac[i].second * ac[j].second >
L * ac[j].second +
ac[i].first * ac[i].second * ac[j].second)
{
g = max(g, U[j]);
}
}
U[i] = g + 1;
ans = max(ans, U[i]);
}
printf("%d", ans);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |