题目链接 Problem Description Chiaki is interested in an infinite sequence $$$a_1,a_2,a_3,...,$$$ which is defined as follows: $$$a_n= \begin{cases} 1, & \text{$$$n=1,2$$$} \\ a_{n-a_{n-1}}+a_{n-1-a_{n-2}} & \text{$$$n\ge 3$$$} \end{cases}$$$ Chiaki wo…
题目链接 Problem Description In a galaxy far, far away, there are two integer sequence a and b of length n. b is a static permutation of 1 to n. Initially a is filled with zeroes. There are two kind of operations: 1.add l r: add one for $$$a_l, a_{l+1}..…
题目链接 Problem Description Chiaki has an array of n positive integers. You are told some facts about the array: for every two elements $$$a_i$$$ and  $$$a_j$$$ in the subarray $$$a_{l,r} (l ≤ i < j ≤ r )$$$, $$$a_i≠a_j$$$ holds. Chiaki would like to fi…
Game Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 184    Accepted Submission(s): 132 Problem Description Alice and Bob are playing a game.The game is played on a set of positive integers from…
题目链接 Problem Description There are $$$n$$$ intersections in Bytetown, connected with $$$m$$$ one way streets. Little $$$Q$$$ likes sport walking very much, he plans to walk for q days. On the $$$i$$$-th day, Little $$$Q$$$ plans to start walking at t…
#include<bits/stdc++.h>using namespace std;int n,m;int x,y;int num,cnt;int degree[100007],vis[100007],viss[400040],first[100007];vector<int>jidian,road[100007];struct node{    int v,next;}xu[400040];void init()//初始化{    num=0,cnt=1;    memset(…
#include<bits/stdc++.h>using namespace std;int a[100010];char s[20];int zhiren[100010];vector<int>haoren[100010];int sum=0;void dfs(int x,int y,int flag){    if(x==y)        flag=1;//如果和被指认的人相同,则定为狼    sum+=flag;//并且后面直接或间接认为刚才那个是狼的人是好人的人也都是狼 …
//never use translation#include<bits/stdc++.h>using namespace std;int k;char a[20];//储存每个数的数值int times[20];//mn次数int timess[20];//mx次数int len;int mn;int mx;int kk,sum;void solve(){    kk=0,sum=0;    if(a[times[1]]==0)        return;    for(int i=1;i…
#include<bits/stdc++.h>using namespace std;const int mod =1e9+7;int dp[1<<10];int cnt[1<<10];int ans[1<<10];char c[10];int t;void add(int &x,int y){    x=x+y>=mod?x+y-mod:x+y;}void del(int &x,int y){    x=x-y<0?x-y+mo…
大意: 给定序列$a$, 给定$m$个操作, 求最后序列每一项的值. 一共$3$种操作, 其中第$k$种操作将序列变为$b_i=\sum\limits_{j=i-kx}a_j$, $(0\le x,1\le j\le i\le n)$ 可以发现$\sum b_ix^i=(\sum a_i x^i)(\sum x^{ki})$, 转化为求$(\sum x^{ki})^{cnt}$ 直接快速幂会$T$, 注意到$(\sum x^{ki})^n=\sum\binom{n-1+i}{i}x^{ki}$,…