因为睡过了只好vp。

  A:阅读理解。

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
int read()
{
int x=,f=;char c=getchar();
while (c<''||c>'') {if (c=='-') f=-;c=getchar();}
while (c>=''&&c<='') x=(x<<)+(x<<)+(c^),c=getchar();
return x*f;
}
#define N
int x,y,z,t1,t2,t3;
int main()
{
cin>>x>>y>>z>>t1>>t2>>t3;
if (abs(y-x)*t1>=t3*+t2*(abs(x-z)+abs(y-x))) cout<<"YES";
else cout<<"NO";
return ;
}

  B:一个数可以作为mex当且仅当所有比它小的自然数都已出现。

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
int read()
{
int x=,f=;char c=getchar();
while (c<''||c>'') {if (c=='-') f=-;c=getchar();}
while (c>=''&&c<='') x=(x<<)+(x<<)+(c^),c=getchar();
return x*f;
}
#define N 100010
int n,a[N],mx;
int main()
{
n=read();
for (int i=;i<=n;i++) a[i]=read();
mx=-;
for (int i=;i<=n;i++)
{
if (a[i]>mx+) {cout<<i;return ;}
mx=max(mx,a[i]);
}
cout<<-;
return ;
}

  C:li=ri=0的人一定是最大值,给他们记录答案后将其去掉并更新其他人的li和ri即可。

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
int read()
{
int x=,f=;char c=getchar();
while (c<''||c>'') {if (c=='-') f=-;c=getchar();}
while (c>=''&&c<='') x=(x<<)+(x<<)+(c^),c=getchar();
return x*f;
}
#define N 1010
int n,a[N],b[N],ans[N],cnt=;
int main()
{
n=read();
for (int i=;i<=n;i++) a[i]=read();
for (int i=;i<=n;i++) b[i]=read();
for (int i=;i<=n;i++)
{
bool flag=;
for (int j=;j<=n;j++)
if (a[j]==&&b[j]==) flag=,cnt++,ans[j]=n-i+,a[j]=b[j]=n+;
if (!flag) {cout<<"NO";return ;}
if (cnt==n) break;
int tot=;
for (int j=;j<=n;j++)
if (a[j]==n+&&b[j]==n+) tot++;
else if (a[j]<tot) {cout<<"NO";return ;}
else a[j]-=tot;
tot=;
for (int j=n;j>=;j--)
if (a[j]==n+&&b[j]==n+) tot++;
else if (b[j]<tot) {cout<<"NO";return ;}
else b[j]-=tot;
for (int j=;j<=n;j++)
if (a[j]==n+&&b[j]==n+) a[j]=b[j]=n+;
}
cout<<"YES\n";
for (int i=;i<=n;i++) cout<<ans[i]<<' ';
return ;
}

  D:注意到对某个位置的数取反会使所有包含他的区间的异或和取反。区间异或和显然可以转化为两个前缀的异或和。这样就可以发现我们对于每一个前缀和都可以任意决定是否取反了。花了1h没救了。

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<map>
using namespace std;
int read()
{
int x=,f=;char c=getchar();
while (c<''||c>'') {if (c=='-') f=-;c=getchar();}
while (c>=''&&c<='') x=(x<<)+(x<<)+(c^),c=getchar();
return x*f;
}
#define N 200010
int n,m,a[N];
map<int,int> f;
long long ans;
int main()
{
n=read(),m=read();f[]++;
for (int i=;i<=n;i++)
{
a[i]=a[i-]^read();
if (a[i]<(<<m-)) f[a[i]]++;
else f[((<<m)-)^a[i]]++;
}
for (int i=;i<=n;i++) if (a[i]>=(<<m-)) a[i]^=((<<m)-);
ans=1ll*n*(n+)>>;
sort(a,a+n+);int t=unique(a,a+n+)-a-;
for (int i=;i<=t;i++)
{
int x=f[a[i]],p=x/,q=(x+)/;
ans-=1ll*p*(p-)/,ans-=1ll*q*(q-)/;
}
cout<<ans;
return ;
}

  result:rank 426

Mail.Ru Cup 2018 Round 1 virtual participate记的更多相关文章

  1. Mail.Ru Cup 2018 Round 3 B. Divide Candies

    题目链接 分析一下题意可以得到题目要求的是满足下面这个 公式的不同的i,ji,ji,j的方案数; 即(i2+j2)mod&ThinSpace;&ThinSpace; m=0 (n ≤  ...

  2. Mail.Ru Cup 2018 Round 3

    A:签到 #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> # ...

  3. Mail.Ru Cup 2018 Round 2

    A:阅读理解. #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> ...

  4. [codeforces Mail.Ru Cup 2018 Round 3][B Divide Candies ][思维+数学]

    https://codeforces.com/contest/1056/problem/B 题意:输入n,m    求((a*a)+(b*b))%m==0的(a,b)种数(1<=a,b<= ...

  5. [codeforces Mail.Ru Cup 2018 Round 1 D][ xor 操作]

    http://codeforces.com/contest/1054/problem/D 题目大意:一个序列a1 a2...an,可以对若干个元素进行取反,使所得的新序列异或和为0的区间个数最多. 题 ...

  6. Mail.Ru Cup 2018 Round 2 Solution

    A. Metro Solved. 题意: 有两条铁轨,都是单向的,一条是从左往右,一条是从右往左,Bob要从第一条轨道的第一个位置出发,Alice的位置处于第s个位置,有火车会行驶在铁轨上,一共有n个 ...

  7. Mail.Ru Cup 2018 Round 3 Solution

    A. Determine Line Water. #include <bits/stdc++.h> using namespace std; ]; int main() { while ( ...

  8. Mail.Ru Cup 2018 Round 1

    A. Elevator or Stairs? 签. #include <bits/stdc++.h> using namespace std; ]; int main() { while ...

  9. Mail.Ru Cup 2018 Round 2C(__gcd)

    #include<bits/stdc++.h>using namespace std;long long mx(long long l1,long long r1,long long l2 ...

随机推荐

  1. Hive支持行级update、delete时遇到的问题

    Hive从0.14版本开始支持事务和行级更新,但缺省是不支持的,需要一些附加的配置.要想支持行级insert.update.delete,需要配置Hive支持事务.(行级的insert好像不配置也能运 ...

  2. 不老的神器--namp,awvs

    要会使用的工具 NESSUS nmap awvs hydra burpsuit 工具的话,都有文档,应该多使用 -h 多看官方文档,就会用了. 1.namp基本用法 -iL <inputfile ...

  3. 254. Drop Eggs【LintCode java】

    Description There is a building of n floors. If an egg drops from the k th floor or above, it will b ...

  4. 157. Unique Characters 【LintCode by java】

    Description Implement an algorithm to determine if a string has all unique characters. Example Given ...

  5. 干货来袭:Redis5.0支持的新功能说明

    Redis5.0支持的新特性说明 本文内容来自华为云帮助中心 华为云DCS的Redis5.x版本继承了4.x版本的所有功能增强以及新的命令,同时还兼容开源Redis5.x版本的新增特性. Stream ...

  6. Simple Pipelined Function

    SELECT * FROM TABLE(PKG_TEST.FN_DIC_DB_TAB) CREATE OR REPLACE PACKAGE PKG_TEST IS   TYPE OBJ_DICDB_R ...

  7. C Program进阶-数组

    (一)数组的内存布局 对于语句int a[5]; 我们明白这里定义了一个数组,数组里有5个元素,每一个元素都是int类型,我们可以用a[0],a[1]等访问数组里的元素,但是这些元素的名字就是a[0] ...

  8. Linux 应用笔记

    Linux 应用笔记 Linux 应用笔记 小书匠 Raspberry Pi 常用命令 CentOs Raspberry Ubuntu python 实用教程 Vim 权限问题 内存分配 shell ...

  9. Hadoop 版本 生态圈 MapReduce模型

    忘的差不多了, 先补概念, 然后开始搭建集群实战 ... . 一 Hadoop版本 和 生态圈 1. Hadoop版本 (1) Apache Hadoop版本介绍 Apache的开源项目开发流程 : ...

  10. BluetoothClass详解

    一. BluetoothClass简介 1. 继承关系 public final class BluetoothClass extends Object implements Parcelable 该 ...