国产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久久精品国产91久久性色也 | 亚洲欧美日本另类激情 | 制服丝袜中文字幕在线 | 国产一区二区在线播放 | 图片专区亚洲 欧美 另类 | 免费一看一级毛片全播放 | 亚洲国产一区二区三区精品 | 欧美日韩综合精品一区二区三区 | 欧美特黄一区二区三区 | 国产精品亚洲专区在线观看 | 国产精品免费精品自在线观看 | 成人a网 | 91麻豆国产精品91久久久 | 久久精品2 | 日韩 综合| 日韩欧美激情 | 欧美日韩中文国产 | a级毛片在线免费观看 | 久久精品国产三级不卡 | 国产三级小视频 | 日本高清天码一区在线播放 | 欧美视频网站在线观看 | 亚洲精品成人久久久影院 | 欧美精品首页 | 无遮挡黄色 | 成人精品在线视频 | 国产精品久久久天天影视香蕉 | 国产丝袜美女一区二区三区 | 成人精品视频一区二区在线 | 国产欧美在线观看精品一区二区 | 成人a免费α片在线视频网站 | 无遮挡色视频 | 久久精品国产999久久久 | 国产淫语打电话对白在线播放 | 日韩精品一区在线观看 | 国产亚洲一区二区精品 | 国产精品亚洲色图 | 精品视频在线观看视频免费视频 | 亚洲精品一| 国内精品一区二区2021在线 | 久久久久久久99久久久毒国产 |