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

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

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

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

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;}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
成人免费在线视频网站| 亚洲а∨天堂久久精品喷水| 538国产精品一区二区免费视频| 欧美精品免费看| 欧美成年人在线观看| 国产精品免费视频久久久| 亚洲天堂av电影| 欧美精品videos另类日本| 国产精品久久久久久超碰| 欧美日韩国产123| 欧美激情一区二区三区在线视频观看| 国产成人精品优优av| 亚洲激情免费观看| 亚洲a一级视频| 美女视频黄免费的亚洲男人天堂| 亚洲电影av在线| 亚洲一区999| 琪琪第一精品导航| www.亚洲人.com| 国产精品久久久久久久久久小说| 日韩一区二区av| 在线观看欧美成人| 国产香蕉97碰碰久久人人| 2021久久精品国产99国产精品| 日韩www在线| 在线成人激情视频| 国产精品27p| 欧美午夜精品在线| 国产裸体写真av一区二区| 亚洲欧美日韩成人| 国产精品1区2区在线观看| 欧美日韩国产第一页| 精品久久久久久国产| 亚洲精品福利免费在线观看| 久久国产精品久久久| 久久中文字幕一区| 国产深夜精品福利| 91久久精品日日躁夜夜躁国产| 亚洲va男人天堂| 精品国产一区二区三区久久久狼| 国产精品激情av电影在线观看| 亚洲精品久久7777777| 最好看的2019年中文视频| 97在线视频免费观看| 日韩在线精品一区| 欧美激情videoshd| 欧美午夜丰满在线18影院| 91成人天堂久久成人| 国产视频丨精品|在线观看| 日韩大片免费观看视频播放| 91精品视频大全| 亚洲免费成人av电影| 一区二区三区视频在线| 欧美夫妻性视频| 欧美人在线视频| 亚洲美女精品久久| 成人免费视频网| 国产成人小视频在线观看| 91美女片黄在线观| 国产精品ⅴa在线观看h| 久久久久久久久久国产| 国产精品色午夜在线观看| 欧美激情高清视频| 日韩亚洲欧美中文在线| 欧美成人免费视频| 欧美一区二区三区四区在线| 亚洲国产精品美女| 日韩欧美成人精品| 久久精品成人欧美大片古装| 亚洲电影免费在线观看| 久久在线视频在线| 亚洲小视频在线观看| 成人黄色av网| 欧美成人一区二区三区电影| 国精产品一区一区三区有限在线| 国产精品久久久久久久电影| 欧美激情视频一区二区三区不卡| 国产精品极品美女粉嫩高清在线| 一区二区中文字幕| 精品伊人久久97| 亚洲成人动漫在线播放| 欧美成年人视频网站欧美| 国产精品永久免费在线| 欧美丰满片xxx777| 亚洲第一精品夜夜躁人人躁| 国产午夜精品久久久| 久久久av免费| 欧美第一黄色网| 国产精品偷伦一区二区| 久久国产精品久久久久久| 92看片淫黄大片看国产片| 欧美激情网站在线观看| 亚洲欧美日韩久久久久久| 黑人巨大精品欧美一区免费视频| 136fldh精品导航福利| 91亚洲精品在线| 欧美性xxxx18| 日韩中文字幕亚洲| 亚洲国产精品系列| 91久久精品美女| 欧美日韩中文字幕在线| 欧美性生交xxxxxdddd| 亚洲一区二区三区sesese| 欧美午夜精品在线| 欧美大片免费看| 中文字幕日韩欧美在线视频| 国产+成+人+亚洲欧洲| 国产91在线播放九色快色| 国产精品扒开腿做爽爽爽的视频| 这里只有精品丝袜| 狠狠久久五月精品中文字幕| 久久久久久久影院| 亚洲电影免费观看高清完整版在线观看| 91精品在线播放| 国产97在线|亚洲| 亚洲免费电影在线观看| 成人写真福利网| 日韩av高清不卡| 国产在线视频不卡| 日韩av在线最新| 亚洲3p在线观看| 国产精品视频播放| 亚洲欧美国产精品va在线观看| 国产成人精品网站| 丝袜亚洲欧美日韩综合| 91精品综合久久久久久五月天| 最好看的2019年中文视频| 久久综合免费视频影院| 日韩性生活视频| 国产97在线亚洲| 久久精品夜夜夜夜夜久久| 欧美成在线观看| 国产成人精品一区二区三区| 久99九色视频在线观看| 亚洲欧洲一区二区三区在线观看| 国产精品久久久久久亚洲影视| 欧美日韩视频免费播放| www日韩欧美| 亚洲国产日韩欧美在线99| 欧美亚洲国产视频| 91国产一区在线| 精品久久久免费| 91九色综合久久| 亚洲美腿欧美激情另类| 91夜夜揉人人捏人人添红杏| 国产精品免费观看在线| 国产精品69av| 日韩精品中文字幕在线| 中文字幕不卡在线视频极品| 欧美三级免费观看| 日韩亚洲欧美中文在线| 久久久电影免费观看完整版| 欧洲美女7788成人免费视频| 精品无人区太爽高潮在线播放| xxxxxxxxx欧美| 国产精品专区第二| 最近2019好看的中文字幕免费| 欧美老女人性生活| 欧美中在线观看| 国产精品xxxxx| 成人有码视频在线播放| 精品福利樱桃av导航| 红桃视频成人在线观看| 欧美做受高潮1|