Submission #1763938


Source Code Expand

#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define FORD(x,y,z) for(int x=y;x>=z;x--)
#define MSET(x,y) memset(x,y,sizeof(x))
#define FOR(x,y) for(__typeof(y.begin()) x=y.begin();x!=y.end();x++)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define M 2005
void RI(){}
template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d",&head);
    RI(tail...);
}
using namespace std;
typedef long long LL;
int n,z,w;
int in[M],dp[2][M][M];
int main()
{
	while(~scanf("%d %d %d",&n,&z,&w))
	{
		REP(i,1,n) RI(in[i]);
		if(n==1) {
			printf("%d\n", abs(in[n]-w));
			continue;
		}
		printf("%d\n", max(
			abs(in[n] - in[n-1]),
			abs(in[n] - w)
		));
	}
	return 0;
}

Submission Info

Submission Time
Task D - ABS
User Nekosyndrome
Language C++14 (GCC 5.4.1)
Score 500
Code Size 779 Byte
Status AC
Exec Time 1 ms
Memory 256 KiB

Compile Error

./Main.cpp: In function ‘void RI(int&, T& ...) [with T = {}]’:
./Main.cpp:15:5: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&head);
     ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 4
AC × 28
Set Name Test Cases
Sample example_0, example_1, example_2, example_3
All example_0, example_1, example_2, example_3, one_0, one_1, one_2, one_3, one_4, one_5, one_6, one_7, rand_0, rand_1, rand_10, rand_11, rand_12, rand_13, rand_14, rand_15, rand_2, rand_3, rand_4, rand_5, rand_6, rand_7, rand_8, rand_9
Case Name Status Exec Time Memory
example_0 AC 1 ms 256 KiB
example_1 AC 1 ms 256 KiB
example_2 AC 1 ms 256 KiB
example_3 AC 1 ms 256 KiB
one_0 AC 1 ms 256 KiB
one_1 AC 1 ms 256 KiB
one_2 AC 1 ms 256 KiB
one_3 AC 1 ms 256 KiB
one_4 AC 1 ms 256 KiB
one_5 AC 1 ms 256 KiB
one_6 AC 1 ms 256 KiB
one_7 AC 1 ms 256 KiB
rand_0 AC 1 ms 256 KiB
rand_1 AC 1 ms 256 KiB
rand_10 AC 1 ms 256 KiB
rand_11 AC 1 ms 256 KiB
rand_12 AC 1 ms 256 KiB
rand_13 AC 1 ms 256 KiB
rand_14 AC 1 ms 256 KiB
rand_15 AC 1 ms 256 KiB
rand_2 AC 1 ms 256 KiB
rand_3 AC 1 ms 256 KiB
rand_4 AC 1 ms 256 KiB
rand_5 AC 1 ms 256 KiB
rand_6 AC 1 ms 256 KiB
rand_7 AC 1 ms 256 KiB
rand_8 AC 1 ms 256 KiB
rand_9 AC 1 ms 256 KiB