2017 ACM/ICPC Asia Regional Shenyang Online card card card


题意:看后面也应该知道是什么意思了
解法:
我们设置l,r,符合条件就是l=起始点,r=当前点,不符合l=i+1
学习了一下FASTIO
#include <iostream>
#include <algorithm>
#include <set>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <list>
#include <iomanip>
#include <functional>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
//#define read read()
#define edl putchar('\n')
#define ll long long
#define clr(a,b) memset(a,b,sizeof a)
#define rep(i,m,n) for(int i=m ; i<=n ; i++)
#define fep(i,n) for(int i=0 ; i<n ; i++)
//inline int read{ int x=0;char c=getchar();while(c<'0' || c>'9')c=getchar();while(c>='0' && c<='9'){ x=x*10+c-'0';c=getchar(); }return x;} namespace FastIO {
const int SIZE = << ;
char buf[SIZE], obuf[SIZE], str[];
int bi = SIZE, bn = SIZE, opt;
int read(char *s) {
while (bn) {
for (; bi < bn && buf[bi] <= ' '; bi++);
if (bi < bn) break;
bn = fread(buf, , SIZE, stdin);
bi = ;
}
int sn = ;
while (bn) {
for (; bi < bn && buf[bi] > ' '; bi++) s[sn++] = buf[bi];
if (bi < bn) break;
bn = fread(buf, , SIZE, stdin);
bi = ;
}
s[sn] = ;
return sn;
}
bool read(int& x) {
int n = read(str), bf; if (!n) return ;
int i = ; if (str[i] == '-') bf = -, i++; else bf = ;
for (x = ; i < n; i++) x = x * + str[i] - '';
if (bf < ) x = -x;
return ;
}
};
#define read(x) FastIO::read(x)
using namespace std;
int X[*],Y[*];
const int maxn = ;
int n, m, mp[maxn][maxn], link[maxn];
bool vis[maxn];
int main() { while(read(n)) {
for(int i=;i<=n;i++){
read(X[i]);
X[n+i]=X[i];
}
for(int i=;i<=n;i++){
read(Y[i]);
Y[i]=X[i]-Y[i];
Y[i+n]=Y[i];
}
int sum=;
int ans=;
int index=;
int r=;
int St;
int Max=-((<<)-);
for(int i=;i<=*n;i++){
sum+=X[i];
ans+=Y[i];
if(sum>Max){
Max=sum;
St=index;
r=i;
}
if(ans<){
index=i+;
sum=;
ans=;
if(index>n+){
break;
}
}
}
printf("%d\n",St-);
}
return ;
}
2017 ACM/ICPC Asia Regional Shenyang Online card card card的更多相关文章
- 2017 ACM/ICPC Asia Regional Shenyang Online spfa+最长路
transaction transaction transaction Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 132768/1 ...
- 2017 ACM/ICPC Asia Regional Shenyang Online 12 card card card
题目大意: 给出两个长度为n的序列A,B,从1开始依次加Ai,减Bi,分数为第一次为当前和为负数的位置以前的Ai之和(左闭右开区间).同时有一种操作可以把当前的A1,B1移动到序列最后,注意序列A的各 ...
- 2017 ACM/ICPC Asia Regional Shenyang Online(部分题解)
HDU 6197 array array array 题意 输入n和k,表示输入n个整数和可以擦除的次数k,如果至多擦除k次能是的数组中的序列是不上升或者是不下降序列,就是魔力数组,否则不是. 解题思 ...
- 2017 ACM/ICPC Asia Regional Shenyang Online
cable cable cable Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others ...
- HDU 6205(尺取法)2017 ACM/ICPC Asia Regional Shenyang Online
题目链接 emmmm...思路是群里群巨聊天讲这题是用尺取法.....emmm然后就没难度了,不过时间上3000多,有点.....盗了个低配本的读入挂发现就降到2800左右, 翻了下,发现神犇Clar ...
- HDU 6198(2017 ACM/ICPC Asia Regional Shenyang Online)
思路:找规律发现这个数是斐波那契第2*k+3项-1,数据较大矩阵快速幂搞定. 快速幂入门第一题QAQ #include <stdio.h> #include <stdlib.h& ...
- 2017 ACM/ICPC Asia Regional Shenyang Online array array array
2017-09-15 21:05:41 writer:pprp 给出一个序列问能否去掉k的数之后使得整个序列不是递增也不是递减的 先求出LIS,然后倒序求出最长递减子序列长度,然后判断去k的数后长度是 ...
- 2017 ACM/ICPC Asia Regional Shenyang Online transaction transaction transaction
Problem Description Kelukin is a businessman. Every day, he travels around cities to do some busines ...
- 2017 ACM/ICPC Asia Regional Shenyang Online number number number
题意:求n个斐波那契数列组合都无法得到的最小数字 解法: 1 我们先暴力的求出前面几个数字 2 然后再暴力的求递推 3 接着矩阵快速幂(没写错吧?) /*#include<bits/stdc++ ...
随机推荐
- diea破解
选择菜单Help->Register->License server,填上http://idea.iteblog.com/key.php,如图所示: 点击Activate,然后就搞定了.
- 【LeetCode】023. Merge k Sorted Lists
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 题 ...
- 发布django 程序
1.配置需求环境 pip freeze > requirements.txt 在开发环境将工程依赖的包导出. pip install virtualenv pip install virtual ...
- canvas线条笔帽及连接
1) 线条笔帽篇: 1 function draw (id) { 2 var canvas = document.getElementById(id); 3 context = canvas.getC ...
- 人物-IT-马云:马云
ylbtech-人物-IT-马云:马云 马云 (阿里巴巴集团创始人) 马云,男,汉族,中共党员,1964年9月10日生于浙江省杭州市,祖籍浙江省嵊州市谷来镇, 阿里巴巴集团主要创始人,现担任阿里巴巴集 ...
- 创建Ajax
Ajax的全称是Asynchronous javascript and XML = 异步传输 + JS + XML 不需要刷新页面就可以获取新的数据 创建步骤: (1)创建XML对象也就 ...
- CentOS7下源码安装5.6.23
清理CentOS7下的MariaDB. [root@localhost ~]#rpm -qa | gremp mariadb [root@localhost ~]# rpm -e --node ...
- SpringBoot05 数据操作03 -> JPA查询方法的规则定义
请参见<springboot详解>springjpa部分知识 1 按照方法命名来进行查询 待更新... package cn.xiangxu.springboot.repository; ...
- Maven 命令格式及一些常用命令
Maven自身指定定义了一套对项目进行编译,测试,打包,运行,部署等工作的抽象.Maven自己是不实际负责这些工作的,而是把它们交给了插件.所以Maven命令的实际工作执行者是各种各样的插件. 要了解 ...
- 大富翁开发日记:一、使用巨型lua协程
一个大胆的尝试:使用巨型lua协程来表示整个“一局”流程. lua协程是一个很另类的功能,有并发的影子但又不是真的并发,所以真正拿它来做大功能框架的范例不多,通常用于一些小型trick式设计.但这次我 ...