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

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

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

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

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
7777免费精品视频| 黄色成人在线免费| 91免费版网站入口| 日韩中文在线中文网三级| 在线观看免费高清视频97| 欧美精品在线极品| 国产精品久久久久一区二区| 国产精品第七影院| 亚洲深夜福利在线| 亚洲电影av在线| 欧美国产视频日韩| 欧美—级高清免费播放| 欧美激情精品久久久久久久变态| 日本欧美一二三区| 性欧美长视频免费观看不卡| 色妞一区二区三区| 国产精品视频xxx| 国产精品扒开腿做爽爽爽男男| 欧美午夜宅男影院在线观看| 精品高清美女精品国产区| 久久精品久久久久电影| 欧美亚洲在线播放| 欧美精品免费看| 午夜精品一区二区三区视频免费看| 亚洲天堂男人天堂女人天堂| 羞羞色国产精品| 亚洲国产精品va在线| 久久久噜久噜久久综合| 午夜精品福利电影| 不卡中文字幕av| 在线播放国产一区二区三区| 久久久噜噜噜久久久| 在线播放日韩精品| 国产精品香蕉在线观看| 欧美日韩亚洲网| 久久久亚洲福利精品午夜| 亚洲自拍偷拍在线| 亚洲天堂av网| 日韩中文字幕视频| 亚洲日本成人网| 懂色av一区二区三区| 国产成人综合久久| 78色国产精品| 亚洲成人免费网站| 97在线看福利| 亚洲欧美成人精品| 91成人国产在线观看| 亚洲有声小说3d| 国产精品草莓在线免费观看| 美女av一区二区三区| 欧美成人国产va精品日本一级| www.日韩欧美| 日日噜噜噜夜夜爽亚洲精品| 最近2019中文字幕在线高清| 成人女保姆的销魂服务| 亚洲自拍偷拍视频| 91av视频在线观看| 91产国在线观看动作片喷水| 97人洗澡人人免费公开视频碰碰碰| 欧美国产精品日韩| 热久久视久久精品18亚洲精品| 韩国三级日本三级少妇99| 亚洲一区二区免费| 国产一区二区美女视频| 富二代精品短视频| 日韩精品免费在线播放| 亚洲精品自产拍| 亚洲欧洲美洲在线综合| 欧美精品一本久久男人的天堂| 亚洲性视频网站| 国产免费一区二区三区在线能观看| 中文字幕视频一区二区在线有码| 亚洲在线观看视频| 亚洲精品欧美一区二区三区| 久99久在线视频| 91国产一区在线| 国产91ⅴ在线精品免费观看| 91美女片黄在线观看游戏| 91综合免费在线| 国内偷自视频区视频综合| 成人xxxxx| 色综合男人天堂| 精品视频久久久久久| 欧美在线视频一二三| 欧美成人精品不卡视频在线观看| 欧美乱大交xxxxx另类电影| 亚洲一区二区三区在线视频| 国产精品观看在线亚洲人成网| 精品日韩视频在线观看| 欧美午夜精品在线| 国产伦精品一区二区三区精品视频| 国产精品va在线| 亚洲一区二区三区四区在线播放| 成人免费视频网| 不卡在线观看电视剧完整版| 国产成人精品视频在线观看| 欧美中文在线视频| 日本免费在线精品| 国产精品jvid在线观看蜜臀| 色爱av美腿丝袜综合粉嫩av| 亚洲精品久久视频| 成人国产在线激情| 97超碰蝌蚪网人人做人人爽| 久久久久久免费精品| 日韩成人中文电影| 国产午夜精品全部视频在线播放| 欧美国产日韩二区| 欧美精品在线视频观看| 精品国产福利视频| 欧美中文在线观看| 日本免费久久高清视频| 国产视频亚洲精品| 国产精品久久久久久婷婷天堂| 国产精品网红福利| 日韩美女福利视频| 国产精品高潮呻吟久久av野狼| 亚洲视频在线视频| 欧美黄色www| 91视频免费网站| 亚洲丝袜av一区| 国产a级全部精品| 国内精品久久久久影院 日本资源| 欧美高清理论片| 亚洲人成网站999久久久综合| 91亚洲国产成人精品性色| 91精品国产综合久久香蕉的用户体验| 2020欧美日韩在线视频| 日韩av在线天堂网| 美女视频黄免费的亚洲男人天堂| 久久久人成影片一区二区三区观看| 丁香五六月婷婷久久激情| 国产精品99久久久久久白浆小说| 亚洲第一网站男人都懂| 91在线观看免费高清| 亚洲一区二区少妇| 久久精品成人一区二区三区| 亚洲美女在线看| 国产成人精品一区二区三区| 啊v视频在线一区二区三区| 久久99视频精品| www.亚洲免费视频| 国产精品久久久久久av福利| 久久久久久久久久久免费| 久操成人在线视频| 久久福利视频网| 亚洲色图综合网| 97视频在线观看免费高清完整版在线观看| 久久久亚洲网站| 国产精品亚洲视频在线观看| 欧美激情一区二区三区成人| 亚洲天堂第二页| 中文字幕欧美精品在线| 欧美精品videosex性欧美| 欧美性xxxx18| 日韩成人av一区| 欧美成aaa人片在线观看蜜臀| 日韩亚洲精品电影| 永久555www成人免费| 国内精品久久久久| 亚洲黄色av网站| 日韩一区二区三区xxxx| 久久综合色88| 97免费视频在线| 国产精品v片在线观看不卡|