题目链接: http://poj.org/problem?id=3041 Description Bessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 <= N <= 500). The grid contains K asteroids (1 <= K <= 10,000), which are conveniently…
Description Farmer John completed his new barn just last week, complete with all the latest milking technology. Unfortunately, due to engineering problems, all the stalls in the new barn are different. For the first week, Farmer John randomly assigne…
Treasure Exploration Time Limit: 6000MS Memory Limit: 65536K Total Submissions: 7455 Accepted: 3053 Description Have you ever read any book about treasure exploration? Have you ever see any film about treasure exploration? Have you ever explored…
思路: 如果用朴素的方法算O(n^4)超时,这里用折半二分.把数组分成两块,分别计算前后两个的和,然后枚举第一个再二分查找第二个中是否有满足和为0的数. 注意和有重复 #include<iostream> #include<algorithm> #include<cstring> #define ll long long using namespace std; const int N = 4000+5; int a[N],b[N],c[N],d[N]; int mp1…