摘要: ###A.All-Star Game ###B.Bon Voyage ###C.Cinema ###D.Disgusting Relationship ###E.Enigmatic Partition 思路: 先找规律,对于每个a1和m的大小(am=a1+2),都有如图的个数 差分 如图消去 再进行 阅读全文
posted @ 2020-08-04 00:18 Rynar 阅读(383) 评论(0) 推荐(1)
摘要: ###A.Social Distancing 思路:打表,首先当n为偶数时,可以得到答案为(nr)^2 //暴搜巨慢打表 #define sqr(x) (x)*(x) int n,r,r1,r2,cnt,ct; struct node{ int x,y; }a[N]; bool check(int 阅读全文
posted @ 2020-08-01 19:59 Rynar 阅读(307) 评论(0) 推荐(0)
摘要: ###1001.Anti-AK Problem ###1002.Blow up the Enemy int main(){ int T,x,y; scanf("%d",&T); while (T--){ int n; scanf("%d",&n); int mi=1e9,cnt=0,t; for ( 阅读全文
posted @ 2020-07-30 17:41 Rynar 阅读(390) 评论(0) 推荐(0)
摘要: ###1001.Tokitsukaze, CSL and Palindrome Game ###1002.Lady Layton and Stone Game ###1003.Tokitsukaze and Colorful Tree ###1004.Tokitsukaze and Multiple 阅读全文
posted @ 2020-07-28 19:01 Rynar 阅读(458) 评论(0) 推荐(0)
摘要: ###A.African Sort ###B.Binary Vector const int mod=1e9+7; const int N=2e7+10; typedef long long ll; int a[N],b[N]; int qpow(ll x,int y){ ll ans=1; whi 阅读全文
posted @ 2020-07-27 18:37 Rynar 阅读(347) 评论(0) 推荐(0)
摘要: ###A.Portal ###B.Graph 思路:观察分析得,所求值为异或最小生成树的边权和,利用字典树,把每个数按其bit插入深度为30的字典树中,O(nlogn) const int N=2e5+10; const int inf=0x3f3f3f3f; int n; vector<pair< 阅读全文
posted @ 2020-07-25 18:20 Rynar 阅读(496) 评论(0) 推荐(0)
摘要: ###1001.Total Eclipse 思路:从大到小建树,利用并查集路径压缩 int n,m,k; int a[N],rk[N],f[N],vis[N],fa[N]; vector<int>v[N]; int ff(int x){ if (f[x]==x)return x; return f[ 阅读全文
posted @ 2020-07-24 10:24 Rynar 阅读(328) 评论(0) 推荐(0)
摘要: ###1001.Avian Darts ###1002.Boring Task ###1003.Cookies ###1004.Distinct Sub-palindromes 签到题 int n,m,k; void solve(){ cin>>n; if (n==1)cout<<26<<endl; 阅读全文
posted @ 2020-07-22 16:22 Rynar 阅读(556) 评论(0) 推荐(0)
摘要: ###A.Ancient Distance 题意: 思路:利用对分的方法求出所有ancient distance所需的key vertice数,利用key vertice不同的区间(ans[i-1]-ans[i]!=0)表示key vertice为一值时的最小距离 const int N=3e6+1 阅读全文
posted @ 2020-07-20 17:55 Rynar 阅读(231) 评论(0) 推荐(0)
摘要: ###A.B-Suffix Array ###B.Infinite Tree ###C.Domino ###D.Quadratic Form ###E.Counting Spanning Trees ###F.Infinite String Comparision Periodicity Lemma 阅读全文
posted @ 2020-07-19 17:15 Rynar 阅读(200) 评论(0) 推荐(0)