Submission #856059
Source Code Expand
Copy
#include <cstdlib> #include <cmath> #include <climits> #include <cfloat> #include <map> #include <utility> #include <set> #include <iostream> #include <memory> #include <string> #include <vector> #include <algorithm> #include <functional> #include <sstream> #include <deque> #include <complex> #include <stack> #include <queue> #include <cstdio> #include <cctype> #include <cstring> #include <ctime> #include <iterator> #include <bitset> #include <numeric> #include <list> #include <iomanip> #include <cassert> #include <array> #include <tuple> #include <initializer_list> #include <unordered_set> #include <unordered_map> #include <forward_list> using namespace std; using ll = long long; #define rep(j,k) for (int j = 0; j < (int)(k); j++) int n; ll x[100010]; ll L; int Q; int a[100010], b[100010]; // x[i]から2^i回のジャンプで行けるところ const int LOG = 33; ll go[100010][LOG]; int solve(int a, int b) { if (a >= b) return 0; int i = 0; while (go[a][i] <= b) { ++i; } --i; return (1 << i) + solve(go[a][i], b); } int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i = 0; i < n; i++) { cin >> x[i]; } x[n] = 2e9; cin >> L >> Q; for (int i = 0; i < n; i++) { int k = upper_bound(x + i, x + n, x[i] + L) - x; go[i][0] = min(n - 1, k - 1); } for (int i = 0; i < LOG - 1; i++) { for (int j = 0; j < n; j++) { go[j][i + 1] = go[go[j][i]][i]; } } for (int i = 0; i < Q; i++) { int a, b; cin >> a >> b; --a; --b; if (a > b) swap(a, b); cout << 'a' << endl; //cout << solve(a, b) << endl; } }
Submission Info
Submission Time | |
---|---|
Task | E - Tak and Hotels |
User | tubo28 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1795 Byte |
Status | WA |
Exec Time | 823 ms |
Memory | 27008 KB |
Judge Result
Set Name | Sample | Subtask1 | All | ||||||
---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 200 | 0 / 500 | ||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Sample | example_01.txt |
Subtask1 | example_01.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt |
All | example_01.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt, subtask2_13.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
example_01.txt | WA | 4 ms | 256 KB |
subtask1_01.txt | WA | 4 ms | 256 KB |
subtask1_02.txt | WA | 4 ms | 256 KB |
subtask1_03.txt | WA | 10 ms | 512 KB |
subtask1_04.txt | WA | 10 ms | 512 KB |
subtask1_05.txt | WA | 11 ms | 512 KB |
subtask1_06.txt | WA | 11 ms | 384 KB |
subtask1_07.txt | WA | 7 ms | 384 KB |
subtask1_08.txt | WA | 11 ms | 512 KB |
subtask1_09.txt | WA | 11 ms | 512 KB |
subtask1_10.txt | WA | 11 ms | 512 KB |
subtask1_11.txt | WA | 11 ms | 512 KB |
subtask1_12.txt | WA | 11 ms | 512 KB |
subtask1_13.txt | WA | 10 ms | 512 KB |
subtask2_01.txt | WA | 818 ms | 27008 KB |
subtask2_02.txt | WA | 765 ms | 27008 KB |
subtask2_03.txt | WA | 822 ms | 27008 KB |
subtask2_04.txt | WA | 470 ms | 17792 KB |
subtask2_05.txt | WA | 446 ms | 17792 KB |
subtask2_06.txt | WA | 696 ms | 27008 KB |
subtask2_07.txt | WA | 681 ms | 27008 KB |
subtask2_08.txt | WA | 708 ms | 27008 KB |
subtask2_09.txt | WA | 698 ms | 27008 KB |
subtask2_10.txt | WA | 821 ms | 27008 KB |
subtask2_11.txt | WA | 815 ms | 24960 KB |
subtask2_12.txt | WA | 823 ms | 27008 KB |
subtask2_13.txt | WA | 706 ms | 27008 KB |