Submission #4063054
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<string> vstr;
typedef pair<ll, ll> pll;
typedef vector<pll> vp;
typedef map<string, ll> mstrll;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fir first
#define sec second
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
#define out(x) cout << x
#define print(x) cout << x << '\n'
#define debug(x) cerr << #x << ": " << x << '\n'
const ll INF = 1e16;
const ll MOD = 1e9 + 7;
ll a, b, c, n, m, x, y, z, w, h, ans = 0, cnt = 0, mx = 0, mn = INF;
string s, t;
vll dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
//vll dx = {-1, 0, 1, -1, 1, -1, 0, 1}, dy = {-1, -1, -1, 0, 0, 1, 1, 1};
signed main(){
cin.tie(0);
ios::sync_with_stdio(false);
while(cin >> n >> m){
mn = INF;
rep(i, n){
cin >> a;
mins(mn, abs(a - m));
}
print(mn);
}
}
Submission Info
Submission Time |
|
Task |
C - Skip |
User |
Regent_50m |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1392 Byte |
Status |
WA |
Exec Time |
11 ms |
Memory |
256 KB |
Judge Result
Set Name |
All |
Sample |
Score / Max Score |
0 / 300 |
0 / 0 |
Status |
|
|
Set Name |
Test Cases |
All |
hand_1, large_1, large_2, large_3, large_4, large_5, large_6, large_7, large_8, max_1, max_2, max_3, min_1, min_2, sample_01, sample_02, sample_03, small_1, small_2, small_3, small_4, small_5 |
Sample |
sample_01, sample_02, sample_03 |
Case Name |
Status |
Exec Time |
Memory |
hand_1 |
AC |
1 ms |
256 KB |
large_1 |
AC |
3 ms |
256 KB |
large_2 |
AC |
3 ms |
256 KB |
large_3 |
AC |
3 ms |
256 KB |
large_4 |
WA |
1 ms |
256 KB |
large_5 |
WA |
1 ms |
256 KB |
large_6 |
WA |
1 ms |
256 KB |
large_7 |
WA |
1 ms |
256 KB |
large_8 |
WA |
1 ms |
256 KB |
max_1 |
WA |
11 ms |
256 KB |
max_2 |
WA |
11 ms |
256 KB |
max_3 |
WA |
11 ms |
256 KB |
min_1 |
AC |
1 ms |
256 KB |
min_2 |
AC |
1 ms |
256 KB |
sample_01 |
AC |
1 ms |
256 KB |
sample_02 |
AC |
1 ms |
256 KB |
sample_03 |
AC |
1 ms |
256 KB |
small_1 |
AC |
1 ms |
256 KB |
small_2 |
AC |
1 ms |
256 KB |
small_3 |
AC |
1 ms |
256 KB |
small_4 |
AC |
1 ms |
256 KB |
small_5 |
WA |
1 ms |
256 KB |