比赛地址
个人博客
github
A
/*
* Author: Moon-light
* 按照题意输出
*/
#include
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define lowbit(x) ((x)&(-x))
#define sz(x) ((int)x.size())
#define fr(x) freopen(x,'r',stdin)
#define fw(x) freopen(x,'w',stdout)
#define mst(x,a) memset(x,a,sizeof(x))
#define all(a) begin(a),end(a)
#define bitcnt(x) (__builtin_popcountll(x))
#define rep(i,a,b) for(int i = (a);i<=(b); ++i)
#define per(i,a,b) for(int i = (a);i>=(b); --i)
typedef long long LL;
typedef pair PII;
typedef pair PLL;
typedef pair PDD;
typedef vector VI;
typedef vector VVI;
typedef vector VB;
typedef double db;
template void clear(T& a) { T().swap(a);}
template
inline bool upmin(T& a,const S&b){ return a>b ? a=b,1:0;}
template
inline bool upmax(T&a, const S&b){ return a>= 1;
a = a*a%mod;
}
return mod;
}
int gcd(int a,int b) {
return b==0? a:gcd(b,a%b);
}
//
//code from here! Come on! Have a pleasant experience~
int main()
{
IO;
int a,b,c,d;
cin>>a>>b>>c>>d;
cout<
B
/*
* Author: Moon-light
* 按照题意边模拟边判断即可
*/
#include
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define lowbit(x) ((x)&(-x))
#define sz(x) ((int)x.size())
#define fr(x) freopen(x,'r',stdin)
#define fw(x) freopen(x,'w',stdout)
#define mst(x,a) memset(x,a,sizeof(x))
#define all(a) begin(a),end(a)
#define bitcnt(x) (__builtin_popcountll(x))
#define rep(i,a,b) for(int i = (a);i<=(b); ++i)
#define per(i,a,b) for(int i = (a);i>=(b); --i)
typedef long long LL;
typedef pair PII;
typedef pair PLL;
typedef pair PDD;
typedef vector VI;
typedef vector VVI;
typedef vector VB;
typedef double db;
template void clear(T& a) { T().swap(a);}
template
inline bool upmin(T& a,const S&b){ return a>b ? a=b,1:0;}
template
inline bool upmax(T&a, const S&b){ return a>= 1;
a = a*a%mod;
}
return mod;
}
int gcd(int a,int b) {
return b==0? a:gcd(b,a%b);
}
//
LL m,n,t;
LL a,b;
//code from here! Come on! Have a pleasant experience~
int main()
{
IO;
cin>>n>>m>>t;
LL left = n;
LL last = 0;
m -= 1;
cin>>a>>b;
left -= a;
if(left <= 0) {
cout<<"No"< n) left = n;
for(int i = 1; i<=m; i++){
cin>>a>>b;
left = left - (a-last);
if(left <= 0) {
cout<<"No"< n) left = n;
last = b;
}
left = left - (t-last);
if(left <= 0){
cout<<"No"<
C
/*
* Author: Moon-light
* 题意:一根木棍分成12段的切法数量,两种切法不同当且仅当切割的位置不同
* 求组合数即可,注意一个木棍可切割的位置是n-1
* 那么answer = C(11,n-1);
*/
#include
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define lowbit(x) ((x)&(-x))
#define sz(x) ((int)x.size())
#define fr(x) freopen(x,'r',stdin)
#define fw(x) freopen(x,'w',stdout)
#define mst(x,a) memset(x,a,sizeof(x))
#define all(a) begin(a),end(a)
#define bitcnt(x) (__builtin_popcountll(x))
#define rep(i,a,b) for(int i = (a);i<=(b); ++i)
#define per(i,a,b) for(int i = (a);i>=(b); --i)
typedef long long LL;
typedef pair PII;
typedef pair PLL;
typedef pair PDD;
typedef vector VI;
typedef vector VVI;
typedef vector VB;
typedef double db;
template void clear(T& a) { T().swap(a);}
template
inline bool upmin(T& a,const S&b){ return a>b ? a=b,1:0;}
template
inline bool upmax(T&a, const S&b){ return a>= 1;
a = a*a%mod;
}
return mod;
}
int gcd(int a,int b) {
return b==0? a:gcd(b,a%b);
}
void solve(){
for(int i = 0; i>n;
solve();
cout<
D
/*
* Author: Moon-light
*
* 思路:因为不能碰到蓝色的方块,所以我们只能找蓝色方块分割开的白色序列中找最小的连续的子序列
* 然后求次数即可,注意首尾的边界情况
*/
#include
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define lowbit(x) ((x)&(-x))
#define sz(x) ((int)x.size())
#define fr(x) freopen(x,'r',stdin)
#define fw(x) freopen(x,'w',stdout)
#define mst(x,a) memset(x,a,sizeof(x))
#define all(a) begin(a),end(a)
#define bitcnt(x) (__builtin_popcountll(x))
#define rep(i,a,b) for(int i = (a);i<=(b); ++i)
#define per(i,a,b) for(int i = (a);i>=(b); --i)
typedef long long LL;
typedef pair PII;
typedef pair PLL;
typedef pair PDD;
typedef vector VI;
typedef vector VVI;
typedef vector VB;
typedef double db;
template void clear(T& a) { T().swap(a);}
template
inline bool upmin(T& a,const S&b){ return a>b ? a=b,1:0;}
template
inline bool upmax(T&a, const S&b){ return a>= 1;
a = a*a%mod;
}
return mod;
}
int gcd(int a,int b) {
return b==0? a:gcd(b,a%b);
}
//
//code from here! Come on! Have a pleasant experience~
int main()
{
IO;
cin>>n>>m;
for(int i = 1; i<=m; i++){
cin>>a[i];
}
sort(a+1,a+1+m);
if(m == 0){
cout<<1< 0) range = min(range,t);
last = a[i];
}
if(n > last){
if(range == 0) range = (n-last);
else range = min(range,n-last);
}
//cout< 1){
ans += (a[1]-2)/range+1;
}
for(int i = 2; i<=m; i++){
int cnt = a[i]-last-1;
ans += (cnt-1)/range+1;
last = a[i];
}
if(n>last)
ans += (n-last-1)/range + 1;
cout<
E
/*
* Author: Moon-light
*
* 题意: 有两个长度分别为N和M的序列A,B
* 删除序列A中的a个元素得到A' , 0<=a<=N
* 删除序列B中的b个元素得到B' , 0<=b<=M
* 使得A'的长度等于B'的长度
* 令x = a + b
* y = Sum of i A'i != B'i
*
* 思路: 编辑距离模型
* 设dp[i][j] 表示对A前i个及对B前j个元素的最小答案
* 那么对于当前的A[i]和 B[j]
* 有三种情况: 1.删除A[i],保留B[j] dp[i-1][j] + 1
* 2.保留A[i],删除B[j] dp[i][j-1] + 1
* 3.保留A[i], 保留A[j] dp[i-1][j-1] + (a[i]==b[j]?0:1)
*/
#include
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define lowbit(x) ((x)&(-x))
#define sz(x) ((int)x.size())
#define fr(x) freopen(x,'r',stdin)
#define fw(x) freopen(x,'w',stdout)
#define mst(x,a) memset(x,a,sizeof(x))
#define all(a) begin(a),end(a)
#define bitcnt(x) (__builtin_popcountll(x))
#define rep(i,a,b) for(int i = (a);i<=(b); ++i)
#define per(i,a,b) for(int i = (a);i>=(b); --i)
typedef long long LL;
typedef pair PII;
typedef pair PLL;
typedef pair PDD;
typedef vector VI;
typedef vector VVI;
typedef vector VB;
typedef double db;
template void clear(T& a) { T().swap(a);}
template
inline bool upmin(T& a,const S&b){ return a>b ? a=b,1:0;}
template
inline bool upmax(T&a, const S&b){ return a>= 1;
a = a*a%mod;
}
return mod;
}
int gcd(int a,int b) {
return b==0? a:gcd(b,a%b);
}
//
//code from here! Come on! Have a pleasant experience~
int main()
{
IO;
cin>>n>>m;
rep(i,1,n) cin>>a[i];
rep(i,1,m) cin>>b[i];
//initialization
rep(i,1,n) dp[i][0] = i;
rep(i,1,m) dp[0][i] = i;
rep(i,1,n){
rep(j,1,m){
//删一个
dp[i][j] = min(dp[i-1][j]+1,dp[i][j-1]+1);
//不删
dp[i][j] = min(dp[i][j], dp[i-1][j-1] + (a[i]==b[j]?0:1));
}
}
cout<
F
/*
* Author: Moon-light
* 题意: 1.单点修改 Ax = Ax ^ Y
* 2.区间查询 Ax1 ^ Ax2 ^ Ax3 ^... ^ Ay
*
* 思路: 树状数组模板
*/
#include
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define lowbit(x) ((x)&(-x))
#define sz(x) ((int)x.size())
#define fr(x) freopen(x,'r',stdin)
#define fw(x) freopen(x,'w',stdout)
#define mst(x,a) memset(x,a,sizeof(x))
#define all(a) begin(a),end(a)
#define bitcnt(x) (__builtin_popcountll(x))
#define rep(i,a,b) for(int i = (a);i<=(b); ++i)
#define per(i,a,b) for(int i = (a);i>=(b); --i)
typedef long long LL;
typedef pair PII;
typedef pair PLL;
typedef pair PDD;
typedef vector VI;
typedef vector VVI;
typedef vector VB;
typedef double db;
template void clear(T& a) { T().swap(a);}
template
inline bool upmin(T& a,const S&b){ return a>b ? a=b,1:0;}
template
inline bool upmax(T&a, const S&b){ return a>= 1;
a = a*a%mod;
}
return mod;
}
int gcd(int a,int b) {
return b==0? a:gcd(b,a%b);
}
void update(int u,int x){
for(int i = u; i<=n; i+=lowbit(i)){
tr[i] ^= x;
}
}
int query(int x){
int res = 0;
for(int i = x; i; i-=lowbit(i)){
res ^= tr[i];
}
return res;
}
//
//code from here! Come on! Have a pleasant experience~
int main()
{
IO;
cin>>n>>q;
rep(i,1,n){
cin>>x;
update(i,x);
}
rep(i,1,q){
cin>>t>>x>>y;
if(t == 1){
update(x,y);
}else{
cout<<(query(y)^query(x-1))<