Submission #40452288
Source Code Expand
Copy
#include <bits/stdc++.h>#define INF 999999999999typedef long long ll;using namespace std;ll n, d;int main() {ios_base::sync_with_stdio(false);cin.tie(0);cin >> n >> d;ll pre_t = -INF, t;for(ll i = 0; i < n; i++) {cin >> t;if(t - pre_t <= d) {cout << t << '\n';return 0;}pre_t = t;}
#include <bits/stdc++.h> #define INF 999999999999 typedef long long ll; using namespace std; ll n, d; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> d; ll pre_t = -INF, t; for(ll i = 0; i < n; i++) { cin >> t; if(t - pre_t <= d) { cout << t << '\n'; return 0; } pre_t = t; } cout << -1 << '\n'; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Double Click |
User | jbhus |
Language | C++ (GCC 9.2.1) |
Score | 100 |
Code Size | 408 Byte |
Status | AC |
Exec Time | 7 ms |
Memory | 3620 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 100 / 100 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | example_00.txt, example_01.txt, example_02.txt |
All | example_00.txt, example_01.txt, example_02.txt, test_00.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
example_00.txt | AC | 7 ms | 3536 KB |
example_01.txt | AC | 3 ms | 3464 KB |
example_02.txt | AC | 2 ms | 3500 KB |
test_00.txt | AC | 2 ms | 3544 KB |
test_01.txt | AC | 4 ms | 3536 KB |
test_02.txt | AC | 2 ms | 3544 KB |
test_03.txt | AC | 3 ms | 3396 KB |
test_04.txt | AC | 3 ms | 3620 KB |
test_05.txt | AC | 2 ms | 3412 KB |
test_06.txt | AC | 1 ms | 3476 KB |
test_07.txt | AC | 2 ms | 3468 KB |
test_08.txt | AC | 2 ms | 3464 KB |
test_09.txt | AC | 2 ms | 3352 KB |
test_10.txt | AC | 3 ms | 3428 KB |
test_11.txt | AC | 2 ms | 3472 KB |