Codeforces Round #385 (Div. 2), problem: (E) Hongcow Buys a Deck of Cards Solution in C/C++

By |2017-04-07T22:11:46+00:00December 18th, 2016|Categories: C/C++, Programming|Tags: , , , , , , , |

#include<bits/stdc++.h> using namespace std; const int maxn=16,INF=0x3f3f3f3f; char type[maxn]; int R[maxn],B[maxn]; char readchar() { for(;;) { char ch=getchar(); if(!isspace(ch)) { return ch; } } } int n; typedef pair<int,int> pii; typedef set<pii> Spii; Spii dp[1<<maxn]; void Insert(Spii& s,const pii& p) { Spii::iterator it=s.lower_bound(p); if(it==s.begin()||(--it)->second>p.second) [...]