# Antiarithmetic?

Tags:
Time Limit:  1 s      Memory Limit:   128 MB
Submission：4     AC：1     Score：99.89

## Description

A permutation of n is a bijective function of the initial n natural numbers: 0, 1, ... n-1. A permutation p is called antiarithmetic if there is no subsequence of it forming an arithmetic progression of length bigger than 2, i.e. there are no three indices 0 ≤ i < j < k < n such that (pi , pj , pk) forms an arithmetic progression.

For example, the sequence (2, 0, 1, 4, 3) is an antiarithmetic permutation of 5. The sequence (0, 5, 4, 3, 1, 2) is not an antiarithmetic permutation as its first, fifth and sixth term (0, 1, 2) form an arithmetic progression; and so do its second, forth and fifth term (5, 3, 1).

Your task is to check whether a given permutation of n is antiarithmetic.

There are several test cases, followed by a line containing 0. Each test case is a line of the input file containing a natural number 3 ≤ n ≤ 10000 followed by a colon and then followed by n distinct numbers separated by whitespace. All n numbers are natural numbers smaller than n.

For each test case output one line with yes or no stating whether the permutation is antiarithmetic or not.
{"ft_lang_label":"__label__en","ft_lang_prob":0.8727129,"math_prob":0.99230444,"size":1127,"snap":"2021-04-2021-17","text_gpt3_token_len":292,"char_repetition_ratio":0.14692788,"word_repetition_ratio":0.0,"special_character_ratio":0.2635315,"punctuation_ratio":0.1557377,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9943386,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-01-18T16:44:12Z\",\"WARC-Record-ID\":\"<urn:uuid:9c1ad601-b044-41b3-993e-13cabe3f858b>\",\"Content-Length\":\"16090\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:cad19cd3-4c6a-41c1-9908-14711f8ccfbc>\",\"WARC-Concurrent-To\":\"<urn:uuid:f5d6ae3a-4dd2-4dd4-a58c-2bea0848cdca>\",\"WARC-IP-Address\":\"112.13.67.100\",\"WARC-Target-URI\":\"http://acm.hznu.edu.cn/OJ/problem.php?id=1326\",\"WARC-Payload-Digest\":\"sha1:QQHYJIDUP63O6JJEKSMKGKSJ72AROAXB\",\"WARC-Block-Digest\":\"sha1:DCJ22C3JXVBA3RMWRMRCBL35RN4RP6XK\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-04/CC-MAIN-2021-04_segments_1610703515075.32_warc_CC-MAIN-20210118154332-20210118184332-00425.warc.gz\"}"}