1 28寒假集訓 1(補題)

2021-08-15 03:11:17 字數 732 閱讀 2700

學不會今天的內容——種樹,只能補補昨天的題了otz

先補了個昨天的g題(竟因沒反應過來priority queue是優先佇列沒有寫qaq太菜了)

kattis - guessthedatastructure 

題意:給n行資料,如果是1就塞進去,2就拿出來,判斷是佇列還是優先佇列還是棧,都不是就輸出impossible,不確定就輸出not sure.

思路:stl**↓

#include#include#includeusing namespace std;

int main()

else

else

is_queue=0;

if(!pq.empty())

else

is_priority_queue=0;

if(!st.empty())

else

is_stack=0;

} }

if(is_queue==1) flag++;

if(is_priority_queue==1) flag++;

if(is_stack==1) flag++;

if(flag==0)

printf("impossible\n");

else if(flag==1)

else

printf("not sure\n");

} return 0;

}

寒假集訓一補題與題解

排序 中位數性質 int a 100010 void sort int l,int r return false 如果所有的都不滿足,那麼這個平均數就一定不滿足 int main while r l 1e 5 printf d n int r 1000 return 0 兩邊的牛高 中間的牛矮資料範...

寒假集訓二補題與題解

統計字首個數,一想到字串的字首,我們就應該想到字典樹,這個和字典一樣的字首樹.這道題目是字典樹模板的略微改動,我們發現這道題目和一般字典樹的查詢不一樣,字典樹一般查詢是看這個字串是否出現,而這道題目這是統計這個字串出現的次數.includeusing namespace std const int ...

寒假集訓四補題與題解

採摘花生也需要單位1的時間 最後只需退回馬路上即可,不需要返回起點,退回馬路所需的時間即為當前位置的行號 include include includeusing namespace std int n,m,t int bu,sum int a 22 22 struct you hh 22 22 b...