Andrew Stankevich Contest 45 (ASC 45)
阿新 • • 發佈:2020-11-16
經典隊內倒二啊 十分經典 感覺有蠻久沒訓練了 一打起來十分拉跨
Problem A CFGym 100520A Analogous Sets +++
Problem B CFGym 100520B Bayes' Law ???
Problem C CFGym 100520C Catalian Sequences ???
Problem D CFGym 100520D Drunkard's Walk !!!
正解的想法我們想過的 不知道為啥把它hack了 丟
構造一棵滿二叉樹然後分配葉子結點就行
其中 p個指向home q-p個指向bar 剩餘的指向1號結點
這樣的話流量最終都只會流向那q個結點
#include<bits/stdc++.h> using namespace std; const int N = 300; int s[15],p2[15]; #define LOCAL int main(){ #ifdef LOCAL freopen("drunkard.in", "r", stdin); freopen("drunkard.out", "w", stdout); #endif int p,q; p2[0] = 1; s[0] = 1; for(int i = 1; i <= 10; i++){ p2[i] = p2[i-1]*2; s[i] = s[i-1] + p2[i]; } while(~scanf("%d%d",&p,&q)){ if(p==0&&q==0) break; int j; for(int i = 1; i <= 10; i++){ if(q <= p2[i]){ j = i; break; } } int n = s[j] + 2; printf("%d\n",n); for(int i = 1; i <= n-2-p2[j]; i++){ printf("%d %d\n",i*2,i*2+1); } int now = n-2-p2[j]+1; for(int i = now; i <= now+p-1; i++){ printf("%d %d\n",n-1,n-1); } now+=p; for(int i = now; i <= now+q-p-1; i++){ printf("%d %d\n",n,n); } now+=q-p; for(int i = now; i <= n-2; i++){ printf("%d %d\n",1,1); } } return 0; }
Problem E CFGym 100520E Elegant Scheduling ???
Problem F CFGym 100520F Flights !!!
Problem G CFGym 100520G Genome of English Literature ???
Problem H CFGym 100520H Hide-and-Seek ???
Problem I CFGym 100520I Informatics Final Project ???
Problem J CFGym 100520J Japanese Origami ???
Problem K CFGym 100520K Kabbalah for Two !!!