Pagini recente » Monitorul de evaluare | Diferente pentru problema/gcycle intre reviziile 9 si 8 | Cod sursa (job #644144) | Cod sursa (job #2840378) | Cod sursa (job #3347891)
#include <fstream>
#include <utility>
#define x first
#define y second
#include <algorithm>
using namespace std;
ifstream in("cadrane.in");
ofstream out("cadrane.out");
/** (<=, <=) & (>=, >=) countt **/
/** qwerty - vertical line (aka. x boundd) **/
typedef pair <int, int> pii;
const int nmax = 1e5, maxint = (1 << 30);
int n, maxpoints; pii a[nmax + 2];
int getminpoints(int xx){
int minpoints = maxint;
for(int i = 1, score; i <= n; i++){
pii py = make_pair(xx, a[i].y); score = 0;
for(int j = 1; j <= n; j++){
score += ((a[j].x <= py.x && a[j].y <= py.y) ||
(a[j].x >= py.x && a[j].y >= py.y));
}
minpoints = min(minpoints, score);
}
return minpoints;
}
int main(){
in>>n;
for(int i = 1; i <= n; i++){
in>>a[i].x>>a[i].y;
}
for(int i = 1; i <= n; i++){
maxpoints = max(maxpoints, getminpoints(a[i].x));
}
out<<maxpoints<<"\n";
return 0;
}