赛后总结:

T:今天下午参加了答辩比赛,没有给予队友很大的帮助。远程做题的时候发现队友在H上遇到了挫折,然后我就和她们说我看H吧,她们就开始做了另外两道题。今天一人一道题。最后我们在研究一道dp的时候,被疯狂卡时间和内存,也是最后三十分钟开始写的,感觉受到了挫折。┭┮﹏┭┮

J:今天开场一个多小时都在看H,还是没打出来,就换了别的题。彭彭说他打过F,F就交给他了。看了G好久,感觉好像能做,就做出来了(while循环没弄好,T了一次,简直是个傻子)。最后看了E和J,打了J,还是wa了,自己想的样例没过。。。。最后看了E,先是MLE,改成一维数组之后又T了,心态爆炸。今天一人打了一题,太菜了。

P:下午看到一道自己以前敲过的,然而。。不记得题目意思了(上回也是题目看不懂。。)在金姐的帮助下,我想起了大致方向----第一次在比赛过程中A题(tcl)然后,金姐想另一题的时候,我提供了前缀和的思路,但其实还是靠金姐啦! 谭总A掉我和金姐想不出的H后,就没有然后了。

E - Coins POJ - 1742
F - Break Standard Weight ZOJ - 3706

题意:给你两个标准重量,你可以将其中一个拆分成两个新的重量,问你通过这三个重量,最多能称出几种不同的重量

暴力模拟出三种重量相加减后的值,再去重、去0。

 #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<vector>
#include<ctime>
#include<stack>
using namespace std;
#define inf 0x3f3f3f3f
#define mm(a,b) memset(a,b,sizeof(a))
#define ll long long
#define MAXN 300010
#define MAXM 10000010
int n;
ll a[MAXN];
set<int> se;
int main()
{
int t;
scanf("%d",&t);
int x,y;
while(t--){
scanf("%d %d",&x,&y);
int maxx=;
for(int i=;i<x;i++){//其实循环到x/2就OK了
int a,b,c;
a=i;
b=x-i;
c=y;
se.clear();
se.insert(a);
se.insert(b);
se.insert(c);
se.insert(a+b);
se.insert(a+c);
se.insert(c+b);
se.insert(abs(a-b));
se.insert(abs(a-c));
se.insert(abs(b-c));
se.insert(a+b+c);
se.insert(abs(a+b-c));
se.insert(abs(a-b+c));
se.insert(abs(a-b-c));
se.insert(abs(b-c-a));
se.insert(abs(b+c-a));
se.insert(abs(b-c+a));
set<int>::iterator it=se.begin();
if(*it==){
maxx=max(maxx,(int)se.size()-);
}
else{
maxx=max(maxx,(int)se.size());
}
}
for(int i=;i<y;i++){
int a,b,c;
a=i;
b=y-i;
c=x;
se.clear();
se.insert(a);
se.insert(b);
se.insert(c);
se.insert(a+b);
se.insert(a+c);
se.insert(c+b);
se.insert(abs(a-b));
se.insert(abs(a-c));
se.insert(abs(b-c));
se.insert(a+b+c);
se.insert(abs(a+b-c));
se.insert(abs(a-b+c));
se.insert(abs(a-b-c));
se.insert(abs(b-c-a));
se.insert(abs(b+c-a));
se.insert(abs(b-c+a));
set<int>::iterator it=se.begin();
if(*it==){
maxx=max(maxx,(int)se.size()-);
}
else{
maxx=max(maxx,(int)se.size());
}
}
printf("%d\n",maxx);
}
}
G - Frets On Fire CodeForces - 1119D

  题意:给你一个 s[0][0] ~ s[0][n-1] ,s[i][j] = s[i][0] + j ,查询 s[0][L] ~ s[n-1][R] 有几个不同的数。

  s[0][L] ~ s[n][R] 有几个不同的数只跟区间长度有关,将 s[0][0] ~ s[0][n-1] 丢到set中去重排序得到 a[0] ~ a[m],a[i]的贡献为  len - max( len - ( a[i] - a[i-1] ) , 0 )。

  令 l[i] = a[i] - a[i-1] ,将 l 从小到大排序,假设 x 为 第一个 l[x] >= len ,则 ans = ∑x l[i] + len * (n-x)。

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<vector>
#include<ctime>
#include<stack>
using namespace std;
#define inf 0x3f3f3f3f
#define mm(a,b) memset(a,b,sizeof(a))
#define ll long long
#define MAXN 300010
#define MAXM 10000010
int n;
set<ll>s;
vector<ll>v;
ll sum[MAXN];
int main()
{
ll a;
scanf("%d", &n);
for (int i = ; i < n; ++i)
{
scanf("%lld", &a);
s.insert(a);
}
n = s.size();
set<ll>::iterator it , itt;
itt = it = s.begin();
it++;
for (; it != s.end(); it++)
{
v.push_back(*it - *itt);
itt++;
}
sort(v.begin(), v.end());
for (int i = ; i < n; ++i)
sum[i] = sum[i - ] + v[i - ];
int k;
scanf("%d", &k);
ll l, r;
ll len;
while (k--)
{
scanf("%lld %lld", &l, &r);
len = r - l + ;
if (upper_bound(v.begin(), v.end(), len) == v.end())
{
printf("%lld ", sum[n - ] + len);
}
else
{
int t = upper_bound(v.begin(), v.end(), len) - v.begin();
printf("%lld ", len*(n - t) + sum[t]);
}
}
}
H - Pavel and Triangles CodeForces - 1119E

题意:给你n种木柜,An-1种木棍表示为2^(n-1)的长度有多少根,问你最多可以组成几种不同的等腰或等边三角形。

 贪心。因为第一根木棍长度最小,无法成为后面三角形的腰,所以减去等边三角形,只能作为底边。然后对于1~n-1的边长,先看能分成几个2,与底边总数进行比较,然后取小的。接下来就是一系列删减的操作。当然也要算等边三角形的啦。

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
using namespace std;
const int maxn = 3e5+;
#define MAX_DISTANCE 0x3f3f3f3f
#define mm(a,b) memset(a,b,sizeof(a))
#define ll long long
#define SIGN(A) ((A > 0) ? 1 : -1)
#define NO_DISTANCE 1000000
const double INF = 10000000000.00;
#define LL long long int
#define mod 1000000007
int gcd(int a, int b) { return a == ? b : gcd(b % a, a); }
int n;
ll a[maxn],num;
int main()
{
scanf("%d", &n);
for (int i = ; i < n; i++)
scanf("%lld", &a[i]);
ll ans = a[] / ;
a[] %= ;
ll sum = a[];
for (int i = ; i < n; i++)
{
num = min(sum, a[i] / );
ans += num;
sum -= num;
a[i] -= num*;
ans += a[i] / ;
a[i] %= ;
sum += a[i];
}
cout << ans<<endl;
return ;
}
I - Tesla CodeForces - 996C

题意:一个4*n大小的停车场,第一行和第四行为有编号停车位,中间两行为带有编号的车辆。车辆需要停到对应的编号车位里。车辆可以进行左右移动,以及在边缘进行上下移动,移动一下算一步。如果可以在20000步内,所有车辆都可以停到自己的车位上,就输出解法,不可以输出-1.

 一道模拟和思维的题目。我们可以通过适当变换,将车辆和车位各变成一维数组,对车辆进行移动,即对数组进行移动,尝试是否可以对准车位,然后需要记录一下路径。

/*
I have a dream!A AC deram!!
orz orz orz orz orz orz orz orz orz orz orz
orz orz orz orz orz orz orz orz orz orz orz
orz orz orz orz orz orz orz orz orz orz orz */ #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include<map>
using namespace std;
typedef long long ll;
const int mod = 1e9 + ;
const int N = 4e5 + ;
const int MAXN = 1e5 + ;
const int INF = 0x3f3f3f3f;
int a[][];
int n, k, s;
struct node
{
int id, x, y;
node(int _id, int _x, int _y) {
id = _id;
x = _x;
y = _y;
};
};
vector<node>ans; void stop()
{
for (int i = ; i < * n; i++)
{
if (a[][i] && (a[][i] == a[][i]))
{
ans.push_back(node( a[][i], i / n == ? : , i % n + ));
a[][i] = ;
k--;
} }
}
bool judge()
{
stop();
for (int i = ; i < * n; i++)
{
if (!a[][i])
return true;
}
return false;
} void turn()
{
vector<node>v1, v2;
int t = a[][ * n - ];
for (int i = * n - ; i >= ; i--)
{
a[][i] = a[][i - ];
if (a[][i])
{
if (i > s)
v1.push_back(node(a[][i], i / n == ? : , i % n + ));
else
v2.push_back(node(a[][i], i / n == ? : , i%n + ));
}
}
a[][] = t;
if (t)
v2.push_back(node (t, , ));
vector<node>::iterator it;
for (it = v2.begin(); it != v2.end(); it++)
ans.push_back(*it);
for (it = v1.begin(); it != v1.end(); it++)
ans.push_back(*it);
}
int main()
{
scanf("%d %d", &n, &k);
for (int i = ; i < n; i++)
scanf("%d", &a[][i]);
for (int i = ; i < n; i++)
scanf("%d", &a[][i]);
for (int i = * n - ; i >= n; i--)
scanf("%d", &a[][i]);
for (int i = * n - ; i >= n; i--)
scanf("%d", &a[][i]);
if (!judge())
{
printf("-1\n");
return ;
}
for (int i = ; i < * n; i++)
{
if (!a[][i])
{
s = i;
break;
}
}
while (k)
{
stop();
turn();
s = (s + ) % ( * n);
}
printf("%d\n", ans.size());
vector<node>::iterator it;
for (it = ans.begin(); it != ans.end(); it++)
{
int x = (*it).x;
int y = (*it).y;
int id = (*it).id;
if (x == || x == )
y = n - y + ;
printf("%d %d %d\n", id, x, y);
} return ;
}

HZNU Training 2 for Zhejiang Provincial Collegiate Programming Contest 2019的更多相关文章

  1. HZNU Training 4 for Zhejiang Provincial Collegiate Programming Contest 2019

    今日这场比赛我们准备的题比较全面,二分+数论+最短路+计算几何+dp+思维+签到题等.有较难的防AK题,也有简单的签到题.为大家准备了一份题解和AC代码. A - Meeting with Alien ...

  2. HZNU Training 1 for Zhejiang Provincial Collegiate Programming Contest

    赛后总结: TJ:今天我先到实验室,开始看题,一眼就看了一道防AK的题目,还居然觉得自己能做wwww.然后金姐和彭彭来了以后,我和他们讲了点题目.然后金姐开始搞dfs,我和彭彭看榜研究F题.想了很久脑 ...

  3. zoj The 12th Zhejiang Provincial Collegiate Programming Contest Capture the Flag

    http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5503 The 12th Zhejiang Provincial ...

  4. zoj The 12th Zhejiang Provincial Collegiate Programming Contest Team Formation

    http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5494 The 12th Zhejiang Provincial ...

  5. zoj The 12th Zhejiang Provincial Collegiate Programming Contest Beauty of Array

    http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5496 The 12th Zhejiang Provincial ...

  6. zoj The 12th Zhejiang Provincial Collegiate Programming Contest Lunch Time

    http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5499 The 12th Zhejiang Provincial ...

  7. zoj The 12th Zhejiang Provincial Collegiate Programming Contest Convert QWERTY to Dvorak

    http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5502  The 12th Zhejiang Provincial ...

  8. zoj The 12th Zhejiang Provincial Collegiate Programming Contest May Day Holiday

    http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5500 The 12th Zhejiang Provincial ...

  9. zoj The 12th Zhejiang Provincial Collegiate Programming Contest Demacia of the Ancients

    http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5504  The 12th Zhejiang Provincial ...

随机推荐

  1. angularjs的input防抖

    在开发中,遇到一个这样的需求,使用$scope.$watch()方法监听input值的改变,然后去$resource请求,但是请求过于频繁,需要做逻辑调整.代码如下: var timeout; $sc ...

  2. hdoj 1753 (Java)

    刚刚开始用Java,代码难免不够简洁. import java.math.BigDecimal; import java.util.Scanner; public class Main { publi ...

  3. Struts完成用户新增操作

    点击新增客户出现该页面并完成前后台交互 代码逻辑分析: jsp 页面部分代码 <TABLE id=table_1 style="DISPLAY: none" cellSpac ...

  4. plotly之set_credentials_file问题

    相信了解可视化的同学们都听说过plotly,笔者也是第一次了解这个网站,然后兴冲冲地设置,但是没想到第一次进行在线账号初始化就出现了问题! python3报错为module 'plotly.tools ...

  5. 5、数组的复制(test2.java、test3.java)

    对于数组的复制,在最开始的时候最容易犯的一个错误,那就是自己认为的申请一个数组,然后将已存在的数组赋值到新申请数组名上,这样是错误的,这样仅仅是将数组的地址复制了过去,并不是,将数组内的元素拷贝过去, ...

  6. MVP架构下解决 RxJava 自动解绑问题

    背景 MVP 模式下使用 RxJava 处理网络访问的回调,当数据返回时 Presenter 调用绑定的 View 的方法. 定义 BasePresenter 如下: public class Bas ...

  7. 章节十五、7- 配置文件-Console Logging

    一.创建xml文件 1.创建xml文件 在项目中我们需要专门建一个文件夹来放xml文件或者是其它文件. 2.然后对文件夹进行命名 3.选择new  其它 4.选择XML File 5.给xml文件命名 ...

  8. ABP 配置全局数据过滤器 II

    第一篇 那种写法有些复杂, 简单办法是直接注入 切换到 ***.EntityFramework 项目 在Uow 里面创建 ***EfUnitOfWork.cs 类 public class Coope ...

  9. 驰骋工作流引擎ccflow-流转自定义功能使用说明

    流转自定义功能使用说明 关键字: 驰骋工作流程快速开发平台 工作流程管理系统 工作流引擎 asp.net工作流引擎 java工作流引擎. 节点跳转 节点流转自定义 应用背景: 有一些流程在运行过程中是 ...

  10. Go语言-基本的http请求操作

    Go发起GET请求 基本的GET请求 //基本的GET请求 package main import ( "fmt" "io/ioutil" "net/ ...