Codeforces Round #264 (Div. 2)

WBOY
풀어 주다: 2016-06-07 15:44:18
원래의
1071명이 탐색했습니다.

Codeforces Round #264 (Div. 2) 题目链接 A:注意特判正好的情况,其他就一个个去判断记录最大即可 B:扫一遍,不够的用钱去填即可,把多余能量记录下来 C:把主副对角线处理出来,然后黑白只能各选一个最大的放即可 D:转化为DAG最长路问题,每个数字记录

Codeforces Round #264 (Div. 2)

题目链接

A:注意特判正好的情况,其他就一个个去判断记录最大值即可

B:扫一遍,不够的用钱去填即可,把多余能量记录下来

C:把主副对角线处理出来,然后黑格白格只能各选一个最大的放即可

D:转化为DAG最长路问题,每个数字记录下在每个序列的位置,如果一个数字能放上去,那么肯定是每个序列上的数字都是在之前最末尾数字的后面

E:大力出奇迹,预处理出树,然后每次查询从当前位置一直往上找到一个符合的即可,如果没有符合的就是-1

代码:

A:

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int n, s;

int main() {
	scanf("%d%d", &n, &s);
	int x, y;
	int flag = 1;
	int ans = 0;
	for (int i = 0; i <br>
B:
<pre class="brush:php;toolbar:false">#include <cstdio>
#include <cstring>

const int N = 100005;
typedef long long ll;

int n;
ll h[N];

int main() {
	scanf("%d", &n);
	for (int i = 1; i  h[i - 1]) {
			ll need = h[i] - h[i - 1];
			if (now >= need) {
				now -= need;
			} else {
				ans += need - now;
				now = 0;
			}
		} else {
			now += h[i - 1] - h[i];
		}
	}
	printf("%lld\n", ans);
	return 0;
}</cstring></cstdio>
로그인 후 복사

C:
#include <cstdio>
#include <cstring>

const int N = 2005;

typedef long long ll;

int n;
ll g[N][N], zhu[N + N], fu[N + N];

int main() {
	scanf("%d", &n);
	for (int i = 0; i <br>
D:
<pre class="brush:php;toolbar:false">#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

const int N = 1005;

struct Num {
	int v[10], la;
} num[N];

bool cmp(Num a, Num b) {
	return a.la <br>
E:
<pre class="brush:php;toolbar:false">#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;

const int N = 100005;

int n, q, val[N], f[N];
vector<int> g[N];

void dfs(int u, int fa) {
	f[u] = fa;
	for (int i = 0; i  1) return u;
		u = f[u];
	}
	return -1;
}

int main() {
	scanf("%d%d", &n, &q);
	for (int i = 1; i <br>
<br>



</int></vector></cstring></cstdio>
로그인 후 복사
관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!