Submission #63156

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
631562018-08-01 01:28:59khsoo01Building Bridges (CEOI17_building)C++11
100 / 100
206 ms17336 KiB
#include<bits/stdc++.h>
#define X first
#define Y second
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
const ll N = 100005, L = 18, inf = 1e18;
ll n, def, h[N], a[N], d[N];
ll val (pll &P, ll V) {return P.X*V+P.Y;}
bool valid (pll &A, pll &B, pll &C) {
return (B.Y-A.Y) * (B.X-C.X) < (C.Y-B.Y) * (A.X-B.X);
}
struct hull {
vector<pll> v;
void upd (pll P) {
for(ll i=v.size();i--;) {
if(v[i].X != P.X) break;
else v.pop_back();
}
for(ll i=v.size();i-->1;) {
if(valid(v[i-1], v[i], P)) break;
else v.pop_back();
}
v.push_back(P);
}
ll get (ll P) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

building.cpp: In function 'void Merge(hull&, hull&)':
building.cpp:43:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0,j=0;i<A.v.size()||j<B.v.size();) {
                  ~^~~~~~~~~~~
building.cpp:43:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0,j=0;i<A.v.size()||j<B.v.size();) {
                                ~^~~~~~~~~~~
building.cpp:45:8: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(i == A.v.size()) flag = true;
      ~~^~~~~~~~~~~~~
building.cpp:46:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   else if(j == B.v.size()) flag = false;
           ~~^~~~~~~~~~~~~
building.cpp: In function 'int main()':
building.cpp:57:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&n);
  ~~~~~^~~~~~~~~~~
building.cpp:58:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(ll i=1;i<=n;i++) scanf("%lld",&h[i]);
                       ~~~~~^~~~~~~~~~~~~~
building.cpp:59:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(ll i=1;i<=n;i++) {scanf("%lld",&a[i]); def += a[i];}
                        ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...