You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# include <bits/stdc++.h>
using namespace std ;
const int N = 40010 ;
int n , m ;
int q [ N ] ;
// 40分
bool check ( int a , int b , int c , int d ) {
if ( a > = b | | b > = c | | c > = d ) return 0 ;
if ( ( b - a ) ! = 2 * ( d - c ) ) return 0 ;
if ( 3 * ( b - a ) > = ( c - b ) ) return 0 ;
return 1 ;
}
int g [ N ] [ 4 ] ;
int main ( ) {
# ifndef ONLINE_JUDGE
freopen ( " 468.in " , " r " , stdin ) ;
# endif
cin > > n > > m ;
// 魔法值都是不超过n的正整数,似乎没啥用
// m个魔法物品
for ( int i = 1 ; i < = m ; i + + ) cin > > q [ i ] ; // 读入每个魔法物品的魔法值
for ( int a = 1 ; a < = m ; a + + )
for ( int b = 1 ; b < = m ; b + + )
for ( int c = 1 ; c < = m ; c + + )
for ( int d = 1 ; d < = m ; d + + )
if ( check ( q [ a ] , q [ b ] , q [ c ] , q [ d ] ) )
g [ a ] [ 0 ] + + , g [ b ] [ 1 ] + + , g [ c ] [ 2 ] + + , g [ d ] [ 3 ] + + ;
// a这个枚举到的数字出现了一次, 它是做为a位置出现的
// 找到一组合法的a,b,c,d
// 输出结果
for ( int i = 1 ; i < = m ; i + + )
printf ( " %d %d %d %d \n " , g [ i ] [ 0 ] , g [ i ] [ 1 ] , g [ i ] [ 2 ] , g [ i ] [ 3 ] ) ;
return 0 ;
}