Preprocessor Solution

  • + 28 comments

    It worked for me. Can this refactored?

    #define INF (unsigned)!((int)0)
    #define FUNCTION(name,operator) inline void name(int &current, int candidate) {!(current operator candidate) ? current = candidate : false;}
    #define io(v) cin>>v
    #define toStr(str) #str
    #define foreach(v, i) for (int i = 0; i < v.size(); ++i)