Submission #400551

#TimeUsernameProblemLanguageResultExecution timeMemory
400551A_DGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include "gap.h" #include <bits/stdc++.h> #define ii pair<int,int> #define F first #define S second #define du long double using namespace std; vector<int> vec; long long findGap(int T, int N) { int l=1,r=1e18; int l2=1,r2=1e18; int&ll=l2; int&rl=r2; while(l<r){ MinMax(l,r,l1,r1); vec.push_back(l2); vec.push_back(r2); l=l2; r=r2; } sort(vec.begin(),vec.end()); int ans=0; for(int i=1;i<vec.size();i++)ans=max(ans,vec[i]-vec[i-1]); return ams; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:12:15: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   12 |     int l=1,r=1e18;
      |               ^~~~
gap.cpp:13:17: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   13 |     int l2=1,r2=1e18;
      |                 ^~~~
gap.cpp:17:20: error: 'l1' was not declared in this scope; did you mean 'll'?
   17 |         MinMax(l,r,l1,r1);
      |                    ^~
      |                    ll
gap.cpp:17:23: error: 'r1' was not declared in this scope; did you mean 'rl'?
   17 |         MinMax(l,r,l1,r1);
      |                       ^~
      |                       rl
gap.cpp:25:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for(int i=1;i<vec.size();i++)ans=max(ans,vec[i]-vec[i-1]);
      |                 ~^~~~~~~~~~~
gap.cpp:26:12: error: 'ams' was not declared in this scope; did you mean 'ans'?
   26 |     return ams;
      |            ^~~
      |            ans
gap.cpp:14:9: warning: unused variable 'll' [-Wunused-variable]
   14 |     int&ll=l2;
      |         ^~
gap.cpp:15:9: warning: unused variable 'rl' [-Wunused-variable]
   15 |     int&rl=r2;
      |         ^~