Submission #852854

#TimeUsernameProblemLanguageResultExecution timeMemory
852854anha3k25cvpMountains (IOI17_mountains)C++14
20 / 100
1 ms604 KiB
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define dl double #define st first #define nd second #define II pair <int, int> #include "mountains.h" using namespace std; struct Node { ll x, y; bool operator <(const Node &O) const { return x * O.y - y * O.x > 0; } }; int maximum_deevs(vector<int> y) { int n = y.size(); vector <int> f(n, 1); int ans = 0; for (int i = 0; i < n; i ++) { ans = max(ans, f[i]); Node ma; for (int j = i + 2; j < n; j ++) { Node u = {j - 1 - i, y[j - 1] - y[i]}, v = {j - i, y[j] - y[i]}; if (j == i + 2) ma = u; else if (ma < u) ma = u; if (v < ma) f[j] = max(f[j], f[i] + 1); } } return ans; }

Compilation message (stderr)

mountains.cpp: In function 'int maximum_deevs(std::vector<int>)':
mountains.cpp:15:28: warning: 'ma.Node::y' may be used uninitialized in this function [-Wmaybe-uninitialized]
   15 |         return x * O.y - y * O.x > 0;
      |                          ~~^~~~~
mountains.cpp:25:14: note: 'ma.Node::y' was declared here
   25 |         Node ma;
      |              ^~
mountains.cpp:15:18: warning: 'ma.Node::x' may be used uninitialized in this function [-Wmaybe-uninitialized]
   15 |         return x * O.y - y * O.x > 0;
      |                ~~^~~~~
mountains.cpp:25:14: note: 'ma.Node::x' was declared here
   25 |         Node ma;
      |              ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...