Skip to content

Instantly share code, notes, and snippets.

View Ir1d's full-sized avatar
💭
Looking for internship

Dejia Xu Ir1d

💭
Looking for internship
View GitHub Profile
@selfboot
selfboot / aprilFools.css
Last active December 19, 2015 03:21
win下修改chrome和360浏览器6.0版本的Custom.css,恶搞网页。 setup.py 为 py2exe的转换脚本。
/* HTML PRIDE! */
html {
-webkit-animation: rainbow 8s infinite;
}
/*
Spin all images
*/
img {
-webkit-animation: spin 1s linear infinite;
@lychees
lychees / array.cpp
Last active December 24, 2015 07:21
HDU 4010. Query on The Trees 现在的搞法。
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
using namespace std;
#define REP_1(i, n) for (int i=1;i<=n;++i)
#define Rush for(int ____T=RD(); ____T--;)
/** I/O Accelerator Interface .. **/ //{
#define g (c=getchar())
@lychees
lychees / .cpp
Created July 25, 2015 02:27
HDU 5306. Gorgeous Sequence(暴力线段树)
/** Micro Mezz Macro Flation -- Overheated Economy ., Last Update: Nov. 7th 2014 **/ //{
/** Header .. **/ //{
#pragma comment(linker, "/STACK:36777216")
//#pragma GCC optimize ("O2")
#define LOCAL
//#include "testlib.h"
#include <functional>
#include <algorithm>
#include <iostream>
@cjsoft
cjsoft / ac.cpp
Last active April 11, 2016 14:05
csu1216
#include <iostream>
#include <cstdio>
#include <cstring>
#define pick(a, b) ((a >> (b - 1)) & 1)
#define EPS 1e-7
using namespace std;
typedef long long ll;
int n;
struct trie {
char e;
@andytimes
andytimes / .vimrc
Last active April 30, 2016 11:34
vimrc
filetype plugin indent on
filetype detect
set cindent tabstop=8 shiftwidth=8 cinoptions=l1,:0,(0,g0
" TODO: extern "C" gets indented
" And some sane defaults, optional, but quite nice
set nocompatible
syntax on
colorscheme default
set hls
(by lydrainbowcat)
题意:
给定N个整数a1,a2...an,求1~n的一个排列p1~pn,最大化 abs(abs(abs(abs(a[p1]-a[p2])-a[p3])-a[p4])......-a[pn])。
N<=200, |ai|<=1000
解法:
首先,所有<=0的ai放在最后,可以全部利用起来,使答案不断变大。
于是只需考虑正的ai。找到其中最大的,放在最后,问题变为对于剩余的数做最小化的上述问题。
最小化就比较好做了,相当于把数分成两堆,使得他们的和尽量接近,可以用背包求解。
" let mapleader=","
set guifont=ubuntu\ mono\ for\ powerline:h18
syntax on
set expandtab
" set clipboard=unnamed
set number
set tabstop=4
set shiftwidth=4
set softtabstop=4
set background=dark
@Totoro97
Totoro97 / bzoj 2229.cpp
Created March 2, 2014 08:49
bzoj 2229: [Zjoi2011]最小割
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#define INF (1 << 30)
#define maxn 210
#define maxm 6010
using namespace std;
queue <int> que;
struct str { int v,cap,nex; } edge[maxm];
<?php
$html = '<form><div style="width: 300px; height: 28px; background-size: 276px 28px;display: inline-block;"><input type="text" maxlength="40" name="q"> <input type="submit" value="go"></div></form>';
if(!isset($_GET['q'])) {
echo $html;
} else {
$q = $_GET['q'];
@lychees
lychees / BZOJ_3132.cpp
Created September 3, 2013 10:41
BZOJ 3132. 上帝造题的七分钟
/** Micro Mezz Macro Flation -- Overheated Economy ., Last Update: Aug. 20th 2013 **/ //{
/** Header .. **/ //{
#pragma comment(linker, "/STACK:36777216")
//#pragma GCC optimize ("O2")
#define LOCAL
//#include "testlib.h"
#include <functional>
#include <algorithm>