亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 學院 > 開發設計 > 正文

Codeforces Round #396 (Div. 2) A+B

2019-11-10 19:31:17
字體:
來源:轉載
供稿:網友

A. Mahmoud and Longest Uncommon Subsequence

time limit per test:2 seconds

memory limit per test:256 megabytes

input:standard input

output:standard output

While Mahmoud and Ehab were PRacticing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.

Given two strings a and b, find the length of their longest uncommon subsequence, which is the longest string that is a subsequence of one of them and not a subsequence of the other.

A subsequence of some string is a sequence of characters that appears in the same order in the string, The appearances don’t have to be consecutive, for example, strings “ac”, “bc”, “abc” and “a” are subsequences of string “abc” while strings “abbc” and “acb” are not. The empty string is a subsequence of any string. Any string is a subsequence of itself.

Input

The first line contains string a, and the second line — string b. Both of these strings are non-empty and consist of lowercase letters of English alphabet. The length of each string is not bigger than 105 characters.

Output

If there’s no uncommon subsequence, print “-1”. Otherwise print the length of the longest uncommon subsequence of a and b.

Examples

Input abcd defgh

Output 5

Input a a

Output -1

Note

In the first example: you can choose “defgh” from string b as it is the longest subsequence of string b that doesn’t appear as a subsequence of string a. 題意:判斷兩個串的最長不公共子序列。 題解:-1或者最長的串。 代碼:

#include<bits/stdc++.h>using namespace std;string a,b;int main(){ cin>>a>>b; if(a!=b) cout<<max(a.length(),b.length()); else cout<<"-1"<<endl;}

B. Mahmoud and a Triangle

time limit per test:2 seconds

memory limit per test:256 megabytes

input:standard input

output:standard output

Mahmoud has n line segments, the i-th of them has length ai. Ehab challenged him to use exactly 3 line segments to form a non-degenerate triangle. Mahmoud doesn’t accept challenges unless he is sure he can win, so he asked you to tell him if he should accept the challenge. Given the lengths of the line segments, check if he can choose exactly 3 of them to form a non-degenerate triangle.

Mahmoud should use exactly 3 line segments, he can’t concatenate two line segments or change any length. A non-degenerate triangle is a triangle with positive area.

Input

The first line contains single integer n (3?≤?n?≤?105) — the number of line segments Mahmoud has.

The second line contains n integers a1,?a2,?…,?an (1?≤?ai?≤?109) — the lengths of line segments Mahmoud has.

Output

In the only line print “YES” if he can choose exactly three line segments and form a non-degenerate triangle with them, and “NO” otherwise.

Examples

Input 5 1 5 3 2 4

Output YES

Input 3 4 1 2

Output NO

Note

For the first example, he can use line segments with lengths 2, 4 and 5 to form a non-degenerate triangle. 題意:任取三個數,問能否構成不退化三角形。 題解:排個序判斷一下即可。 代碼:

#include <bits/stdc++.h>#define ll long longusing namespace std;const int N=1e5+10;ll a[N];int main(){ int n; cin>>n; for(int i=1; i<=n; i++) cin>>a[i]; sort(a+1,a+1+n); bool flag=false; for(int i=2; i<n; i++) { if(a[i]+a[i-1]>a[i+1]) flag=true; } if(flag) cout<<"YES"<<endl; else cout<<"NO"<<endl;}
上一篇:log4j日志記錄級別

下一篇:poj1517

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
国产精品va在线播放| 亚洲变态欧美另类捆绑| 亚洲精品成人久久久| 亚洲成人激情小说| 日韩在线播放视频| 亚洲香蕉成视频在线观看| 欧美性猛交xxxxx免费看| 中文字幕日本精品| 91在线精品播放| 88xx成人精品| 亚洲欧洲美洲在线综合| 亚洲日本欧美中文幕| 69久久夜色精品国产69乱青草| 亚洲精品影视在线观看| 欧美激情第一页xxx| 在线观看日韩www视频免费| 亚洲国产精品va在线看黑人动漫| 国产精品久久久久久av下载红粉| 91综合免费在线| 国产精品美女久久久久av超清| 亚洲日韩欧美视频| 国产精品av免费在线观看| 永久555www成人免费| 91亚洲国产精品| 另类天堂视频在线观看| 中文字幕欧美日韩在线| 亚洲女人天堂av| 亚洲国模精品一区| 精品中文视频在线| 欧美一级高清免费| 亚洲国产精品久久精品怡红院| 国产97色在线|日韩| 久久久国产精品视频| 国产精品爱啪在线线免费观看| 91超碰中文字幕久久精品| 精品国产美女在线| 91黑丝在线观看| 亚洲男人的天堂在线| 欧美野外wwwxxx| 精品毛片三在线观看| 国产精品欧美激情在线播放| 中文字幕欧美在线| 国产精品久久av| 精品国偷自产在线视频| 久久精品国产欧美激情| 亚洲欧美日韩一区在线| 日韩av有码在线| 亚洲网在线观看| 亚洲资源在线看| 欧美尤物巨大精品爽| 国产女精品视频网站免费| 最近2019年日本中文免费字幕| 久久在线免费观看视频| 午夜精品久久久久久久久久久久| 麻豆国产精品va在线观看不卡| 午夜精品久久久久久久久久久久| 草民午夜欧美限制a级福利片| 性色av一区二区三区| 久久久天堂国产精品女人| 欧美精品一区在线播放| 91在线免费视频| 久久影视三级福利片| 伊人男人综合视频网| 成人黄色午夜影院| 亚洲激情第一页| 日韩av在线免费观看一区| 久久久久久久久久久亚洲| 国产精品一区二区三区成人| 日韩视频―中文字幕| 神马久久久久久| 国产丝袜一区二区三区免费视频| 国产精品高潮呻吟久久av野狼| 国产精品久久久久久久一区探花| 羞羞色国产精品| 5278欧美一区二区三区| 美女国内精品自产拍在线播放| 欧美大片va欧美在线播放| 91性高湖久久久久久久久_久久99| 亚洲qvod图片区电影| 日韩欧美在线字幕| 亚洲淫片在线视频| 日韩在线视频免费观看| 欧美一级成年大片在线观看| 亚洲最大成人免费视频| 国产午夜精品理论片a级探花| 久久夜精品香蕉| 亚洲黄色片网站| 97在线视频一区| 97精品一区二区视频在线观看| 91久久久久久久久| 狠狠爱在线视频一区| 狠狠久久五月精品中文字幕| 91精品国产91久久久| 日韩精品小视频| 高跟丝袜一区二区三区| 亚洲国产精品久久久久秋霞蜜臀| 97视频在线观看免费高清完整版在线观看| 日韩中文字幕网| 久久天天躁狠狠躁夜夜躁2014| 91sao在线观看国产| 日韩av在线免播放器| 欧美大人香蕉在线| 91国内产香蕉| 久久人人爽人人爽人人片av高请| 欧美日韩免费观看中文| 亚洲成年人影院在线| 91午夜在线播放| 欧美日韩中文字幕在线视频| 亚洲精品久久久久久下一站| 欧美国产极速在线| 亚洲欧美日韩天堂一区二区| 欧美性生交大片免网| 欧美午夜激情小视频| 欧美在线日韩在线| 日韩中文理论片| 美女黄色丝袜一区| 国产精品美女无圣光视频| 成人h猎奇视频网站| 欧美激情一区二区三区高清视频| 中文字幕日韩在线视频| 亚洲图片制服诱惑| 91在线|亚洲| 亚洲二区在线播放视频| 国产97人人超碰caoprom| 最近2019年好看中文字幕视频| 青草热久免费精品视频| 久久99精品久久久久久噜噜| 91成品人片a无限观看| 2019中文字幕全在线观看| 欧美xxxx做受欧美.88| 黑人巨大精品欧美一区二区三区| 国内外成人免费激情在线视频网站| 亚洲精品欧美日韩专区| 国产精品wwwwww| 中文字幕亚洲一区二区三区五十路| 日韩免费在线免费观看| 久久精品欧美视频| 精品久久久中文| 国产美女精品视频免费观看| 亚洲欧美精品一区| 国产精品高潮呻吟久久av黑人| 国产精品福利网站| 国产999精品久久久影片官网| 欧美日韩在线视频观看| 国产成人亚洲综合91| 欧美性猛交xxxx富婆弯腰| 久久久亚洲欧洲日产国码aⅴ| 久久这里有精品| 最近2019中文字幕第三页视频| 亚洲欧美三级伦理| 最好看的2019年中文视频| 国产黑人绿帽在线第一区| 日韩高清人体午夜| 欧美孕妇孕交黑巨大网站| 97精品国产97久久久久久春色| 久久免费高清视频| 57pao国产成人免费| 91中文在线视频| 亚洲欧美国产一本综合首页| 狠狠躁18三区二区一区| 成人网在线视频| 欧美最顶级丰满的aⅴ艳星| 久久久久久网址| 久久久噜噜噜久久中文字免|