This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Update - Thanks to some folks who pointed out a flaw in my code. | |
| * I have updated it. Hope it is correct now :-) | |
| * Old version can be found here - | |
| https://gist.github.com/krisys/4089748/262cbc10d9b9f1cb5df771e14a1e143a86d2ecc6/ | |
| */ | |
| #include <iostream> | |
| #include <vector> | |
| #include <algorithm> | |
| using namespace std; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <vector> | |
| #include <map> | |
| #include <set> | |
| #include <algorithm> | |
| #include <iostream> | |
| #include <cstdio> | |
| #define FOR(i,a,b) for(int i=a;i<b;i++) | |
| #define REP(i,a) FOR(i, 0, a) | |
| #define all(a) a.begin(), a.end() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <algorithm> | |
| #include <iostream> | |
| #include <vector> | |
| #define FOR(i,a,b) for(int i=a;i<b;i++) | |
| #define REP(i,a) FOR(i, 0, a) | |
| #define VI vector<int> | |
| #define all(a) (a).begin(), (a).end() | |
| using namespace std; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <vector> | |
| #include <map> | |
| #include <set> | |
| #include <algorithm> | |
| #include <iostream> | |
| #define FOR(i,a,b) for(int i=a;i<b;i++) | |
| #define REP(i,a) FOR(i, 0, a) | |
| #define all(a) a.begin(), a.end() | |
| #define SORT(a) sort(all(a)) |
OlderNewer