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

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

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

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

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
国产精品视频精品视频| 国产日韩欧美在线看| 久久久久久久电影一区| 亚洲精品电影网站| 欧美专区在线播放| 国产精品视频资源| 国产精品视频自在线| 欧美成人亚洲成人日韩成人| 一区二区亚洲精品国产| 欧美大片大片在线播放| 中文字幕日韩综合av| 亚洲一级黄色av| 国产性色av一区二区| 日韩美女免费观看| 国产精品爱啪在线线免费观看| 久久成人这里只有精品| 日韩中文字幕国产| 91成品人片a无限观看| 疯狂做受xxxx高潮欧美日本| 欧美精品一区在线播放| 久久精品国产免费观看| 在线看欧美日韩| 欧美一级高清免费| 日本韩国在线不卡| 久久精品电影网| 国产精品流白浆视频| 国产视频精品在线| 亚洲在线免费看| 中文字幕精品网| 亚洲伊人成综合成人网| 91在线观看欧美日韩| 久久久国产精品视频| 久久精品夜夜夜夜夜久久| 国产精品手机播放| 亚洲欧美国产制服动漫| 在线性视频日韩欧美| 欧美亚洲国产视频| 在线电影欧美日韩一区二区私密| 国产精品日韩在线观看| 国产精品久久久久福利| 日韩av免费网站| 午夜剧场成人观在线视频免费观看| 欧美日韩一区二区在线播放| 亚洲香蕉在线观看| 亚洲在线视频观看| 插插插亚洲综合网| 亚洲一区中文字幕| 国产精品高清在线观看| 97国产精品久久| 欧美中文在线视频| 久久av在线看| 91免费福利视频| 91sao在线观看国产| 最近2019中文字幕在线高清| 亚洲人精品午夜在线观看| 欧美日韩另类字幕中文| 欧美亚洲第一区| 成人性生交大片免费看视频直播| 亚洲精品98久久久久久中文字幕| 久久成人精品视频| 91香蕉国产在线观看| 欧美夫妻性视频| 久久久欧美一区二区| 欧美视频13p| 在线国产精品播放| 91精品国产91久久久| 亚洲第一天堂无码专区| 亚洲欧美激情一区| 亚洲欧美日韩第一区| 日韩欧美国产一区二区| 亚洲精品98久久久久久中文字幕| 日韩av片电影专区| 日韩a**站在线观看| 久久精品夜夜夜夜夜久久| 亚洲精品国产suv| 国产69精品99久久久久久宅男| 亚洲高清一区二| 久久久久久久久久av| 久久精品小视频| 欧美性猛交xxxx乱大交3| 欧美理论电影网| 日韩精品福利网站| x99av成人免费| 亚洲午夜女主播在线直播| 亚洲欧美一区二区激情| 日本一区二区在线免费播放| 久久国产精品视频| 97久久精品人搡人人玩| 日韩有码在线播放| 国产精品久久久久久av下载红粉| 久久香蕉精品香蕉| 亚洲一区二区三区成人在线视频精品| 亚洲欧美国产精品久久久久久久| 欧美日韩国产一区二区| 成人a在线观看| 国产一区二区日韩精品欧美精品| 欧美黑人狂野猛交老妇| 狠狠色狠狠色综合日日小说| 92看片淫黄大片看国产片| 热久久美女精品天天吊色| 成人激情电影一区二区| 国产精品久久久久久久久久新婚| 精品国内产的精品视频在线观看| 国产999精品久久久| 国产成人拍精品视频午夜网站| 国产精品av网站| 亚州欧美日韩中文视频| 日韩中文字幕在线精品| 国产成人精品av在线| 亚洲国产精品va在线| 欧美精品在线观看91| 亚洲国产日韩一区| 欧美高清视频在线播放| 亚洲男人第一av网站| 亚洲高清av在线| 久久精品精品电影网| 欧美放荡办公室videos4k| 欧美精品videosex极品1| 日韩欧美在线一区| 久久久免费精品视频| 国产精品av免费在线观看| 日本国产精品视频| 亚洲国产97在线精品一区| 亚洲国产欧美久久| 日韩有码在线电影| 亚洲视频在线看| 久久精品国产一区二区三区| 日本精品视频在线观看| 国产精品国产三级国产aⅴ9色| 少妇高潮久久77777| 中文字幕精品国产| 久久激情视频免费观看| 国模私拍一区二区三区| 国语自产在线不卡| 亚洲精品日韩av| 欧美老肥婆性猛交视频| 成人激情视频免费在线| 69av在线视频| 日韩有码在线视频| 8090理伦午夜在线电影| 久久香蕉频线观| 国产一区二区三区中文| 国产一区视频在线播放| 欧美电影在线观看完整版| 国产欧美一区二区三区久久| 黑丝美女久久久| 国产精品欧美激情| 国产精品网址在线| 日本一区二区在线播放| 日韩中文综合网| 国产精品电影网站| 中文字幕av一区二区三区谷原希美| 91免费在线视频网站| 亚洲护士老师的毛茸茸最新章节| 欧美天天综合色影久久精品| 久久久999成人| 国产精品入口福利| 日韩一区av在线| 欧美一级大片在线观看| 国模私拍视频一区| 992tv在线成人免费观看| 亚洲最大激情中文字幕| 这里只有精品在线观看| 欧美高清视频免费观看|