?? pku1868.cpp
字號:
#include <stdio.h>
#include <algorithm>
using namespace std;
typedef struct
{
int x;
int id;
} Node;
const int size = 10001;
Node nd[size];
int N;
bool cp(Node a, Node b)
{
return a.x < b.x;
}
bool Tell(int a, int b, int c)
{
if (a > b && b > c)
{
return 1;
}
if (a < b && b < c)
{
return 1;
}
return 0;
}
bool Solve()
{
int i, j;
for (i = 0; i < N >> 1; i++)
{
for (j = 0; j + 2 * i < N; j++)
{
if (Tell(nd[j].id, nd[j + i].id, nd[j + 2 * i].id))
{
return 1;
}
}
}
return 0;
}
int main()
{
int i;
while (scanf("%d", &N) != -1 && N)
{
scanf(": ");
for (i = 0; i < N; i++)
{
scanf("%d", &nd[i].x);
nd[i].id = i;
}
sort(nd, nd + N, cp);
if (!Solve())
{
printf("yes\n");
}
else
{
printf("no\n");
}
}
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -