diff --git a/Algorithms/Implementation/Charging the Batteries b/Algorithms/Implementation/Charging the Batteries new file mode 100644 index 0000000..dbe6d4d --- /dev/null +++ b/Algorithms/Implementation/Charging the Batteries @@ -0,0 +1,52 @@ +#include +#define pb emplace_back +using namespace std; + + +int main() { + /* Enter your code here. Read input from STDIN. Print output to STDOUT */ + int n,m,k; + cin>>n>>m>>k; + vector v; + for(int i=0;i>x>>y; + if(x==0) + { + v.pb(y); + } + else if(y==n) + { + v.pb(x+n); + + } + else if(x==n) + { + v.pb(3*n-y); + } + else + { + v.pb(4*n-x); + } + } + sort(v.begin(),v.end()); + int d=v.size(); + for(int i=0;i