Codeforces Round #426 (Div. 1), problem: (E) Caramel Clouds Solution In C/C++

By | 2017-08-04T12:34:07+00:00 August 4th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , |

#include <algorithm> #include <cstdio> #include <cstring> #include <map> #include <set> #include <utility> #include <vector> const int N = 300000; struct Sum { int add(int id, int value) { if (a[0].second == id) { a[0].first = std::max(a[0].first, value); } else if (a[1].first < value) { [...]

Codeforces Round #426 (Div. 1), problem: (D) Red-Black Cobweb Solution In C/C++

By | 2017-08-04T12:32:27+00:00 August 4th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , |

#include <iostream> #include <cstring> #include <cstdio> #include <cmath> #include <algorithm> #define maxn 100005 #define mod 1000000007 #define ll long long using namespace std; ll ksm(ll a, ll b) { if(!b) return 1; ll ns = ksm(a, b >> 1); ns *= ns, ns %= [...]