Submission #492704

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4927042021-12-08 13:04:29zhougzDischarging (NOI20_discharging)C++17
100 / 100
138 ms13928 KiB
/**
* author: chowgz
* created: 14/03/2021 11:20:55
**/
#include <bits/stdc++.h>
using namespace std;
constexpr int MAXN = (int)1e6;
struct Line {
int m;
long long c;
long long operator()(int x) {
return (long long)m * x + c;
}
double operator^(const Line &rhs) {
return ((double)c - rhs.c) / ((double)rhs.m - m);
}
};
struct ConvexHull {
Line lines[MAXN + 1];
int l = 0, r = 0;
void operator+=(Line line) {
while (r - l >= 2 && (line ^ lines[r - 1]) <= (lines[r - 1] ^ lines[r - 2])) {
r--;
}
lines[r] = line;
r++;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

Discharging.cpp: In function 'int main()':
Discharging.cpp:18:11: warning: 'dp' may be used uninitialized in this function [-Wmaybe-uninitialized]
   18 |   return ((double)c - rhs.c) / ((double)rhs.m - m);
      |           ^~~~~~~~~
Discharging.cpp:50:12: note: 'dp' was declared here
   50 |  long long dp;
      |            ^~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...