[CodeForces312C]The Closest Pair[实现][贪心]
来源:互联网 发布:js 同时请求 编辑:程序博客网 时间:2024/04/29 12:06
题目链接:[CodeForces312C]The Closest Pair[实现][数学]
题意分析:给出一个最大循环次数K,问:能不能给出个样例,让这哥们的代码TLE。
解题思路:注意这哥们代码里的这句话!!!!
if (p[j].x-p[i].x>=d) then break
于是就有思路了,竟然他剪枝是这么剪的,那么我们就让样例点间X轴距离永远为0,绝对剪不掉!
个人感受:一直以为他的剪枝条件是J点和I点间的距离>=d,被自己蠢哭了。。。。话说,要是他真这么剪枝,那这题怎么破。。。。。???
具体代码如下:
#include<iostream>using namespace std;int main(){ int n, k; cin >> n >> k; if (n * (n - 1) / 2 <= k) cout << "no solution\n"; else { for (int i = 0; i < n; ++i) cout << 0 << ' ' << i << '\n'; } return 0;}
0 0
- [CodeForces312C]The Closest Pair[实现][贪心]
- 10245 - The Closest Pair Problem
- 10245 - The Closest Pair Problem
- UVaOJ10245 - The Closest Pair Problem
- Uva10245-The Closest Pair Problem
- UVA10245 - The Closest Pair Problem
- UVA_10245_ The Closest Pair Problem
- The Closest Pair Problem UVA
- closest pair 算法的实现
- UVa 10245 - The Closest Pair Problem
- UVa 10245 - The Closest Pair Problem
- uva 10245 - The Closest Pair Problem
- 10245 - The Closest Pair ----------水题--二分
- [uva] 10245The Closest Pair Problem
- UVa 10245 - The Closest Pair Problem
- UVA 10245 - The Closest Pair Problem
- uva 10245 The Closest Pair Problem
- uva 10245 The Closest Pair Problem
- javascript 正则表达式提取数字使用
- HTTP简单介绍
- 【黑马程序员】---java基础---内部类、异常
- 主库插入数据从库无法同步
- 哈希函数
- [CodeForces312C]The Closest Pair[实现][贪心]
- 过去半年的工作总结
- android.util.AndroidRuntimeException: requestFeature() must be called before adding content
- 欢迎使用CSDN-markdown编辑器
- Android 即时通讯开发——asmack jar包使用
- 了解maven
- 在Docker中从头部署自己的Spark集群
- Leetcode 108 Convert Sorted Array to Binary Search Tree 有序数组构造平衡二叉查找树
- 深度学习好的学习内容网址链接