国产99久久精品_欧美日本韩国一区二区_激情小说综合网_欧美一级二级视频_午夜av电影_日本久久精品视频

最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
當前位置: 首頁 - 科技 - 知識百科 - 正文

CodeforcesRound#283(Div.2)D.TennisGame_html/css

來源:懂視網 責編:小采 時間:2020-11-27 16:00:03
文檔

CodeforcesRound#283(Div.2)D.TennisGame_html/css

CodeforcesRound#283(Div.2)D.TennisGame_html/css_WEB-ITnose:標程貌似是二分? 我預處理標記了一下,然后從1到n枚舉t,因為對于每個t,若s存在,那么s是唯一的,所以枚舉t即可。 判斷t是否合法,直接暴力的話,會超時 不知道標程大致思想是否跟我的一樣,也許就是標程沒有標記而是二分來找 但是,我的時間復雜度
推薦度:
導讀CodeforcesRound#283(Div.2)D.TennisGame_html/css_WEB-ITnose:標程貌似是二分? 我預處理標記了一下,然后從1到n枚舉t,因為對于每個t,若s存在,那么s是唯一的,所以枚舉t即可。 判斷t是否合法,直接暴力的話,會超時 不知道標程大致思想是否跟我的一樣,也許就是標程沒有標記而是二分來找 但是,我的時間復雜度

標程貌似是二分?

我預處理標記了一下,然后從1到n枚舉t,因為對于每個t,若s存在,那么s是唯一的,所以枚舉t即可。

判斷t是否合法,直接暴力的話,會超時

不知道標程大致思想是否跟我的一樣,也許就是標程沒有標記而是二分來找

但是,我的時間復雜度是更優的,n*(1+1/2+1/3+......1/n)=n*lnn的做法


#include#include#include#include#include#include#include#include#include#includeusing namespace std;struct Ans{	int s,t;	Ans(){}	Ans(int a,int b){s=a;t=b;}	bool operator <(Ans x)const	{	return s!=x.s?sbp[t2]))	{	t1=as[bp[t2]]+s;	t2+=s;	y++;	}	else	return 0;	}}int main(){	int i,t,m;	scanf("%d",&n);	for(i=0;i


D. Tennis Game

time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the next set starts and scores of both players are being set to 0. As soon as one of the players wins the total ofs sets, he wins the match and the match is over. Heres and t are some positive integer numbers.

To spice it up, Petya and Gena choose new numbers s andt before every match. Besides, for the sake of history they keep a record of each match: that is, for each serve they write down the winner. Serve winners are recorded in the chronological order. In a record the set is over as soon as one of the players scores t points and the match is over as soon as one of the players winss sets.

Petya and Gena have found a record of an old match. Unfortunately, the sequence of serves in the record isn't divided into sets and numberss and t for the given match are also lost. The players now wonder what values ofs and t might be. Can you determine all the possible options?

Input

The first line contains a single integer n ? the length of the sequence of games (1?≤?n?≤?105).

The second line contains n space-separated integersai. Ifai?=?1, then thei-th serve was won by Petya, if ai?=?2, then the i-th serve was won by Gena.

It is not guaranteed that at least one option for numberss and t corresponds to the given record.

Output

In the first line print a single number k ? the number of options for numberss and t.

In each of the following k lines print two integerssi andti ? the option for numberss and t. Print the options in the order of increasingsi, and for equalsi ? in the order of increasingti.

Sample test(s)

Input

51 2 1 2 1

Output

21 33 1

Input

41 1 1 1

Output

31 42 24 1

Input

41 2 1 2

Output

Input

82 1 2 1 1 1 1 1

Output

31 62 36 1

聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

CodeforcesRound#283(Div.2)D.TennisGame_html/css

CodeforcesRound#283(Div.2)D.TennisGame_html/css_WEB-ITnose:標程貌似是二分? 我預處理標記了一下,然后從1到n枚舉t,因為對于每個t,若s存在,那么s是唯一的,所以枚舉t即可。 判斷t是否合法,直接暴力的話,會超時 不知道標程大致思想是否跟我的一樣,也許就是標程沒有標記而是二分來找 但是,我的時間復雜度
推薦度:
  • 熱門焦點

最新推薦

猜你喜歡

熱門推薦

專題
Top
主站蜘蛛池模板: 亚欧精品在线观看 | 国产日韩一区二区三区 | 精品视频第一页 | 久久久久成人精品一区二区 | 自拍自偷 | 国产精品视频久久久久久 | 国产91精品对白露脸全集观看 | 自拍偷自拍亚洲精品被多人伦好爽 | 国产视频观看 | 中出在线播放 | 高清不卡一区 | 亚洲日韩精品欧美一区二区 | 亚欧在线 | 亚洲欧美日韩国产综合高清 | 亚欧一区 | 一卡二卡在线 | 一级毛片免费下载 | 伊人久久亚洲综合天堂 | 国产一区二区三区日韩欧美 | 亚洲欧美日韩精品永久在线 | 2021国产精品成人免费视频 | 亚洲欧美国产精品第1页 | 免费一区二区三区在线视频 | 另类专区另类专区亚洲 | 国产精品亚洲精品日韩动图 | 国产毛片一区二区 | 夜夜骑日日操 | 国产国语高清在线视频二区 | 亚洲一区中文字幕在线观看 | a集毛片 | 中文字幕一区二区三区久久网站 | 国产精品成人一区二区 | 91视频一区二区三区 | 成人a毛片免费视频观看 | 国产欧美日韩在线不卡第一页 | 成人日韩 | 国产99视频精品草莓免视看 | a黄毛片| 日韩中文字幕a | 久久国产成人午夜aⅴ影院 久久国产精品成人免费古装 | 日韩经典欧美一区二区三区 |