Submission #66298684
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
/////////////////////// MACROS ///////////////////////
using ll = long long;
using ld = long double;
using db = double;
using str = string;
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using pdb = pair<db, db>;
using vi = vector<int>;
using vl = vector<ll>;
using vd = vector<db>;
using vs = vector<str>;
using vc = vector<char>;
using vb = vector<bool>;
using vpi = vector<pi>;
using vpl = vector<pl>;
#define tcT template<class T
#define tcTU tcT, class U
tcT> using V = vector<T>;
tcT, size_t SZ> using AR = array<T, SZ>;
tcTU> using PR = pair<T,U>;
tcTU> using umap = unordered_map<T, U>;
tcT> using uset = unordered_set<T>;
tcT> using mset = multiset<T>;
tcT> using pqg = priority_queue<T, vector<T>, greater<T>>;
tcT> using pql = priority_queue<T, vector<T>, less<T>>;
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// tcT> using iset = tree<T, null_type, less<T>, rb_tree_tag,
// tree_order_statistics_node_update>;
tcT> bool ckmin(T& a, const T& b) {
return b < a ? a = b, 1 : 0; }
tcT> bool ckmax(T& a, const T& b) {
return a < b ? a = b, 1 : 0; }
#define mp make_pair
#define f first
#define s second
#define nl '\n'
#define sz(x) int((x).size())
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define ppb pop_back
#define ppf pop_front
#define pb push_back
#define eb emplace_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define R0F(i, a) ROF(i, 0, a)
#define each(x, a) for (auto& x: a)
/////////////////////// OUTPUT ///////////////////////
#define ts to_string
str ts(char c) { return str(1,c); }
str ts(const char* s) { return (str)s; }
str ts(str s) { return s; }
str ts(bool b) {
#ifdef LOCAL
return b ? "true" : "false";
#else
return ts((int)b);
#endif
}
tcTU> str ts(pair<T,U> p);
tcTU> str ts(V<pair<T, U>> v);
tcT> str ts(T v);
tcTU> str ts(pair<T,U> p) {
#ifdef LOCAL
return "("+ts(p.f)+", "+ts(p.s)+")";
#else
return ts(p.f)+" "+ts(p.s);
#endif
}
tcTU> str ts(V<pair<T, U>> v) {
#ifdef LOCAL
bool fst = 1; str res = "{";
for (const auto& x: v) {
if (!fst) res += ", ";
fst = 0; res += ts(x);
}
res += "}"; return res;
#else
bool fst = 1; str res = "";
for (const auto& x: v) {
if (!fst) res += " ";
fst = 0; res += ts(x);
}
return res;
#endif
}
tcT> str ts(T v) {
#ifdef LOCAL
bool fst = 1; str res = "{";
for (const auto& x: v) {
if (!fst) res += ", ";
fst = 0; res += ts(x);
}
res += "}"; return res;
#else
bool fst = 1; str res = "";
for (const auto& x: v) {
if (!fst) res += " ";
fst = 0; res += ts(x);
}
return res;
#endif
}
/////////////////////// DEBUG ///////////////////////
#define tcTUU tcT, class ...U
void DBG() { cerr << "]" << "\e[0m" << endl; }
tcTUU> void DBG(const T& t, const U&... u) {
cerr << ts(t); if (sizeof...(u)) cerr << ", ";
DBG(u...); }
#ifdef LOCAL
#define dbg(...) cerr << "\e[1m" << "Line(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__);
#define chk(...) if (!(__VA_ARGS__)) cerr << "Line(" << __LINE__ << ") -> function(" \
<< __FUNCTION__ << ") -> CHK FAILED: (" << #__VA_ARGS__ << ")" << "\n", exit(0);
#else
#define dbg(...) 0
#define chk(...) 0
#endif
/////////////////////// CODE ///////////////////////
const int INF = int(1e9)+100;
const ll LINF = ll(3e18)+10;
const int MOD = int(1e9)+7;
const int MX = int(2e5)+5;
void solve() {
int n, s; cin >> n >> s;
vi a(n); each(x, a) cin >> x;
int cur = 0;
F0R(i, n){
if (a[i]-cur > s){
cout << "No" << nl;
return;
}
cur = a[i];
}
cout << "Yes" << nl;
}
int main(){
cin.tie(0)->sync_with_stdio(0);
int t = 1;
// cin >> t;
while(t--){
solve();
}
}
Submission Info
| Submission Time |
|
| Task |
A - Timeout |
| User |
Nikaa |
| Language |
C++ 20 (gcc 12.2) |
| Score |
150 |
| Code Size |
4256 Byte |
| Status |
AC |
| Exec Time |
1 ms |
| Memory |
3608 KiB |
Judge Result
| Set Name |
Sample |
All |
| Score / Max Score |
0 / 0 |
150 / 150 |
| Status |
|
|
| Set Name |
Test Cases |
| Sample |
00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
| All |
00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt, 01_test_23.txt |
| Case Name |
Status |
Exec Time |
Memory |
| 00_sample_00.txt |
AC |
1 ms |
3472 KiB |
| 00_sample_01.txt |
AC |
1 ms |
3320 KiB |
| 00_sample_02.txt |
AC |
1 ms |
3472 KiB |
| 01_test_00.txt |
AC |
1 ms |
3384 KiB |
| 01_test_01.txt |
AC |
1 ms |
3472 KiB |
| 01_test_02.txt |
AC |
1 ms |
3392 KiB |
| 01_test_03.txt |
AC |
1 ms |
3420 KiB |
| 01_test_04.txt |
AC |
1 ms |
3424 KiB |
| 01_test_05.txt |
AC |
1 ms |
3488 KiB |
| 01_test_06.txt |
AC |
1 ms |
3468 KiB |
| 01_test_07.txt |
AC |
1 ms |
3336 KiB |
| 01_test_08.txt |
AC |
1 ms |
3480 KiB |
| 01_test_09.txt |
AC |
1 ms |
3608 KiB |
| 01_test_10.txt |
AC |
1 ms |
3420 KiB |
| 01_test_11.txt |
AC |
1 ms |
3496 KiB |
| 01_test_12.txt |
AC |
1 ms |
3480 KiB |
| 01_test_13.txt |
AC |
1 ms |
3496 KiB |
| 01_test_14.txt |
AC |
1 ms |
3472 KiB |
| 01_test_15.txt |
AC |
1 ms |
3416 KiB |
| 01_test_16.txt |
AC |
1 ms |
3448 KiB |
| 01_test_17.txt |
AC |
1 ms |
3420 KiB |
| 01_test_18.txt |
AC |
1 ms |
3464 KiB |
| 01_test_19.txt |
AC |
1 ms |
3468 KiB |
| 01_test_20.txt |
AC |
1 ms |
3440 KiB |
| 01_test_21.txt |
AC |
1 ms |
3604 KiB |
| 01_test_22.txt |
AC |
1 ms |
3468 KiB |
| 01_test_23.txt |
AC |
1 ms |
3460 KiB |