Submission #731831

#TimeUsernameProblemLanguageResultExecution timeMemory
731831maeolaWalking (NOI12_walking)C++17
25 / 25
2 ms316 KiB
// 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)

walking.cpp: In function 'int main(int, const char**)':
walking.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf(" %d %d", &L, &N);
      |  ~~~~~^~~~~~~~~~~~~~~~~~
walking.cpp:16:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |   scanf(" %d %d", &t, &v);
      |   ~~~~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...