题目链接:hdu 4911 Inversion
题目大意:给定一个序列,有k次机会交换相邻两个位置的数,问说最后序列的逆序对数最少为多少。
解题思路:每交换一次一定可以减少一个逆序对,所以问题转换成如何求逆序对数。
#include
#include
#include
using namespace std;
typedef long long ll;
const int m...
分类:
其他好文 时间:
2014-08-05 22:32:00
阅读次数:
291
显然每次交换都能减少1
所以求出逆序数对数,然后-=k就好了。。。
_(:зゝ∠)_
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define N 100005
#define ll long long
ll c[N+100000], maxn;
inlin...
分类:
其他好文 时间:
2014-08-05 19:25:20
阅读次数:
213
view code//hdu 3987
#include #include #include #include #include using namespace std;
typedef long long ll;
const ll INF = 1LLq; q.push(s); d[s] = 0; ...
分类:
其他好文 时间:
2014-08-05 19:00:22
阅读次数:
243
Redirect "all" output to a single file: Run: test.bat?>?test.txt?2>&1 and you‘ll get this text on screen (we‘ll never get rid of this line on screen, as it is sent to the Console and cannot be r...
Welcome back to what’s going to be the last “official” part of this series – I’ll do more GPU-related posts in the future, but this series is long eno...
分类:
其他好文 时间:
2014-08-05 02:56:18
阅读次数:
427
Welcome back! This time, we’ll look into what is perhaps the “poster boy” feature introduced with the D3D11 / Shader 5.x hardware generation: Tessella...
分类:
其他好文 时间:
2014-08-05 02:55:48
阅读次数:
272
In this installment, I’ll be talking about the (early) Z pipeline and how it interacts with rasterization. Like the last part, the text won’t procee.....
分类:
其他好文 时间:
2014-08-05 00:34:50
阅读次数:
360
In this part, I’ll be dealing with the first half of pixel processing: dispatch and actual pixel shading. In fact, this is really what most graphics.....
分类:
其他好文 时间:
2014-08-05 00:26:28
阅读次数:
484
Welcome back. Last time, we dove into bottom end of the pixel pipeline. This time, we’ll switch back to the middle of the pipeline to look at what i.....
分类:
其他好文 时间:
2014-08-05 00:25:48
阅读次数:
321
1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int maxn=100005; 7 8 int count[maxn]; 9 int num[maxn],ll[maxn],rr[maxn];10 int...
分类:
其他好文 时间:
2014-08-04 21:03:37
阅读次数:
261