Task: | Skyline |
Sender: | aalto2024i_002 |
Submission time: | 2024-10-30 17:48:22 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.00 s | details |
#2 | ACCEPTED | 0.00 s | details |
#3 | ACCEPTED | 0.00 s | details |
#4 | ACCEPTED | 0.00 s | details |
#5 | ACCEPTED | 0.00 s | details |
#6 | ACCEPTED | 0.00 s | details |
#7 | ACCEPTED | 0.00 s | details |
#8 | WRONG ANSWER | 0.01 s | details |
#9 | ACCEPTED | 0.00 s | details |
#10 | WRONG ANSWER | 0.00 s | details |
#11 | WRONG ANSWER | 0.00 s | details |
#12 | WRONG ANSWER | 0.00 s | details |
#13 | WRONG ANSWER | 0.00 s | details |
#14 | WRONG ANSWER | 0.00 s | details |
#15 | WRONG ANSWER | 0.00 s | details |
#16 | ACCEPTED | 0.00 s | details |
#17 | WRONG ANSWER | 0.00 s | details |
#18 | WRONG ANSWER | 0.00 s | details |
#19 | WRONG ANSWER | 0.00 s | details |
#20 | ACCEPTED | 0.00 s | details |
#21 | WRONG ANSWER | 0.00 s | details |
#22 | ACCEPTED | 0.00 s | details |
#23 | WRONG ANSWER | 0.00 s | details |
#24 | WRONG ANSWER | 0.00 s | details |
#25 | WRONG ANSWER | 0.00 s | details |
#26 | ACCEPTED | 0.00 s | details |
#27 | WRONG ANSWER | 0.00 s | details |
#28 | WRONG ANSWER | 0.00 s | details |
#29 | WRONG ANSWER | 0.00 s | details |
#30 | ACCEPTED | 0.00 s | details |
#31 | TIME LIMIT EXCEEDED | -- | details |
#32 | TIME LIMIT EXCEEDED | -- | details |
#33 | TIME LIMIT EXCEEDED | -- | details |
#34 | TIME LIMIT EXCEEDED | -- | details |
#35 | TIME LIMIT EXCEEDED | -- | details |
#36 | TIME LIMIT EXCEEDED | -- | details |
#37 | TIME LIMIT EXCEEDED | -- | details |
#38 | TIME LIMIT EXCEEDED | -- | details |
#39 | TIME LIMIT EXCEEDED | -- | details |
#40 | TIME LIMIT EXCEEDED | -- | details |
#41 | TIME LIMIT EXCEEDED | -- | details |
#42 | TIME LIMIT EXCEEDED | -- | details |
#43 | TIME LIMIT EXCEEDED | -- | details |
#44 | TIME LIMIT EXCEEDED | -- | details |
#45 | TIME LIMIT EXCEEDED | -- | details |
#46 | TIME LIMIT EXCEEDED | -- | details |
#47 | TIME LIMIT EXCEEDED | -- | details |
#48 | TIME LIMIT EXCEEDED | -- | details |
#49 | TIME LIMIT EXCEEDED | -- | details |
#50 | TIME LIMIT EXCEEDED | -- | details |
#51 | TIME LIMIT EXCEEDED | -- | details |
#52 | TIME LIMIT EXCEEDED | -- | details |
#53 | TIME LIMIT EXCEEDED | -- | details |
#54 | TIME LIMIT EXCEEDED | -- | details |
Compiler report
input/code.cpp: In function 'long long int ford_fulkerson(std::vector<std::vector<long long int> >&, int, int)': input/code.cpp:137:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 137 | for (int i = 1; i < path_reversed.size(); i++) | ~~^~~~~~~~~~~~~~~~~~~~~~
Code
#include <bits/stdc++.h> #define REP(i, a, b) for (int i = a; i < b; i++) // Type Aliases for 1D and 2D vectors with initialization #define vll(n, val) vector<long long>(n, val) // 1D vector of long longs with size n, initialized to val #define ll long long #define vvi(n, m, val) vector<vector<int>>(n, vector<int>(m, val)) // 2D vector of ints (n x m), initialized to val #define vvll(n, m, val) vector<vector<long long>>(n, vector<long long>(m, val)) // 2D vector of long longs (n x m), initialized to val using namespace std; void print_vector(vector<int> &x) { for (int v : x) { cout << v << " "; } cout << "\n"; } void print_matrix(vector<vector<int>> &matrix) { cout << "\n" << "----------------" << "\n"; for (vector<int> row : matrix) { print_vector(row); } cout << "\n" << "----------------" << "\n"; } int calc_max_digit(int n) { int max_digit = 0; while (n > 0 && max_digit < 9) { int digit = n % 10; if (digit > max_digit) { max_digit = digit; } n /= 10; } return max_digit; } // edges as edge list for outgoing node as pairs (end, cost) vector<ll> dijkstras(int start_point, vector<vector<pair<int, int>>> edges) { int n = edges.size(); vector<bool> processed(n, false); vector<ll> distances(n, LLONG_MAX); distances[start_point] = 0; priority_queue<pair<ll, int>> pq; pq.push({0, start_point}); while (!pq.empty()) { int curr = pq.top().second; pq.pop(); if (processed[curr]) { continue; } processed[curr] = true; ll distance = distances[curr]; for (pair<int, int> edge : edges[curr]) { if (distance + edge.second < distances[edge.first]) { distances[edge.first] = distance + edge.second; pq.push({-distances[edge.first], edge.first}); } } } return distances; } int bfs_edmondson_karp(const vector<vector<ll>> &connections, const int source, const int target, vector<int> &path_reversed) { int n = connections.size(); queue<pair<int, ll>> queue; queue.push({source, LLONG_MAX}); vector<int> predecessor(n, -2); predecessor[source] = -1; while (!queue.empty()) { int current = queue.front().first; ll current_bottleneck = queue.front().second; queue.pop(); if (current == target) { while (current != -1) { path_reversed.push_back(current); current = predecessor[current]; } return current_bottleneck; } for (int edge_end = 0; edge_end < n; edge_end++) { ll edge_cap = connections[current][edge_end]; if (edge_cap > 0 && predecessor[edge_end] == -2) { predecessor[edge_end] = current; queue.push({edge_end, min(current_bottleneck, edge_cap)}); } } } return -1; } ll ford_fulkerson(vector<vector<ll>> &residual_graph, const int source, const int target) { ll flow = 0; while (true) { vector<int> path_reversed; int path_capacity = bfs_edmondson_karp(residual_graph, source, target, path_reversed); if (path_capacity < 0) { break; } flow += path_capacity; for (int i = 1; i < path_reversed.size(); i++) { int edge_end = path_reversed[i - 1]; int edge_start = path_reversed[i]; // reduce forwards edge residual_graph[edge_start][edge_end] -= path_capacity; assert(residual_graph[edge_start][edge_end] >= 0); // add to backwards edge residual_graph[edge_end][edge_start] += path_capacity; assert(residual_graph[edge_end][edge_start] >= 0); } } return flow; } bool dfs(int n, const vector<vector<int>> snakes, vector<bool> &visited, vector<int> path, int start, int target) { if (start == target) { path.push_back(target); return true; } for (int i = n; n >= 1; n--) { if (!visited[i] && !snakes[start][i]) { if (dfs(n, snakes, visited, path, i, target)) { path.push_back(start); return true; } } } return false; } int main() { int n, q; cin >> n >> q; vector<int> a(n); vector<int> b(q); for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < q; i++) { cin >> b[i]; } unordered_set<int> possible_heights; possible_heights.insert(0); for (int i = 0; i < n; i++) { for (auto height : possible_heights) { possible_heights.insert(height + a[i]); } } for (auto x : b) { if (possible_heights.find(x) != possible_heights.end()) { cout << "Yes" << " "; } else { cout << "No" << " "; } } cout << endl; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
1 20 8 29 43 23 70 56 72 72 50 43 79 ... |
correct output |
---|
No No No No No No No No No No ... |
user output |
---|
No No No No No No No No No No ... |
Test 2
Verdict: ACCEPTED
input |
---|
2 20 8 8 6 38 42 31 55 41 90 8 74 92 72... |
correct output |
---|
No No No No No No No Yes No No... |
user output |
---|
No No No No No No No Yes No No... |
Test 3
Verdict: ACCEPTED
input |
---|
2 20 8 10 67 92 41 94 85 41 87 67 71 1 2... |
correct output |
---|
No No No No No No No No No No ... |
user output |
---|
No No No No No No No No No No ... |
Test 4
Verdict: ACCEPTED
input |
---|
3 20 8 8 10 58 60 46 57 39 26 28 19 67 99 ... |
correct output |
---|
No No No No No Yes No No No No... |
user output |
---|
No No No No No Yes No No No No... |
Test 5
Verdict: ACCEPTED
input |
---|
3 20 1 7 8 30 69 38 80 10 38 83 43 83 65 ... |
correct output |
---|
No No No No No No No No No No ... |
user output |
---|
No No No No No No No No No No ... |
Test 6
Verdict: ACCEPTED
input |
---|
3 20 10 4 3 83 7 5 38 11 99 60 10 53 61 42... |
correct output |
---|
No Yes No No No No No Yes No N... |
user output |
---|
No Yes No No No No No Yes No N... |
Test 7
Verdict: ACCEPTED
input |
---|
4 20 1 9 5 2 18 36 87 78 99 50 94 76 29 43 ... |
correct output |
---|
No No No No No No No No No No ... |
user output |
---|
No No No No No No No No No No ... |
Test 8
Verdict: WRONG ANSWER
input |
---|
4 20 1 7 4 7 79 78 78 48 66 96 96 100 6 84 ... |
correct output |
---|
No No No No No No No No No No ... |
user output |
---|
No No No No No No No No No No ... |
Test 9
Verdict: ACCEPTED
input |
---|
4 20 8 10 8 2 22 50 48 68 61 28 20 26 95 53 ... |
correct output |
---|
No No No No No Yes Yes Yes No ... |
user output |
---|
No No No No No Yes Yes Yes No ... |
Test 10
Verdict: WRONG ANSWER
input |
---|
4 20 6 1 9 10 16 91 9 41 27 20 58 31 19 20 9... |
correct output |
---|
Yes No Yes No No Yes No No Yes... |
user output |
---|
Yes No Yes No No Yes No No Yes... |
Test 11
Verdict: WRONG ANSWER
input |
---|
5 20 6 8 9 7 9 55 85 43 63 65 39 44 30 90 6 9... |
correct output |
---|
No No No No No Yes No Yes No Y... |
user output |
---|
No No No No No Yes Yes Yes No ... |
Test 12
Verdict: WRONG ANSWER
input |
---|
5 20 10 8 10 1 2 31 100 15 24 10 40 19 39 35 67... |
correct output |
---|
Yes No No No Yes No Yes No No ... |
user output |
---|
No No No No Yes No Yes No No N... |
Test 13
Verdict: WRONG ANSWER
input |
---|
5 20 2 1 10 6 10 44 49 43 33 34 16 21 70 62 12 ... |
correct output |
---|
No No No No No Yes Yes No No Y... |
user output |
---|
No Yes No Yes Yes Yes Yes No N... |
Test 14
Verdict: WRONG ANSWER
input |
---|
5 20 1 8 9 3 2 52 57 90 44 90 2 13 5 21 25 6 ... |
correct output |
---|
No No No No No Yes Yes Yes Yes... |
user output |
---|
No No No No No Yes Yes No Yes ... |
Test 15
Verdict: WRONG ANSWER
input |
---|
5 20 10 6 2 10 9 72 61 70 60 22 15 98 23 1 70 2... |
correct output |
---|
No No No No Yes Yes No No No N... |
user output |
---|
No No No No Yes No No No No No... |
Test 16
Verdict: ACCEPTED
input |
---|
5 20 2 10 10 4 4 92 98 49 9 62 40 77 36 52 49 3... |
correct output |
---|
No No No No No No No No No No ... |
user output |
---|
No No No No No No No No No No ... |
Test 17
Verdict: WRONG ANSWER
input |
---|
5 20 10 4 3 9 1 5 38 11 99 60 10 53 61 42 54 3... |
correct output |
---|
Yes No Yes No No Yes No No No ... |
user output |
---|
Yes No Yes No No Yes No No No ... |
Test 18
Verdict: WRONG ANSWER
input |
---|
5 20 4 8 4 6 10 73 46 98 31 54 27 51 9 8 42 27... |
correct output |
---|
No No No No No No No No Yes No... |
user output |
---|
No No No No No No No No Yes No... |
Test 19
Verdict: WRONG ANSWER
input |
---|
5 20 1 10 3 9 4 54 82 24 43 2 62 44 77 41 41 5... |
correct output |
---|
No No Yes No No No No No No No... |
user output |
---|
No No No No No No No No No No ... |
Test 20
Verdict: ACCEPTED
input |
---|
5 20 4 6 6 6 2 14 32 15 2 22 88 42 14 25 14 9... |
correct output |
---|
Yes No No Yes Yes No No Yes No... |
user output |
---|
Yes No No Yes Yes No No Yes No... |
Test 21
Verdict: WRONG ANSWER
input |
---|
10 20 6 8 9 7 9 6 9 5 7 7 39 44 30 90 6 97 28 39 48 80 8... |
correct output |
---|
Yes Yes Yes No Yes No Yes Yes ... |
user output |
---|
Yes Yes Yes Yes Yes Yes Yes Ye... |
Test 22
Verdict: ACCEPTED
input |
---|
10 20 10 8 10 1 2 4 10 2 3 1 40 19 39 35 67 40 94 54 85 42 ... |
correct output |
---|
Yes Yes Yes Yes No Yes No No N... |
user output |
---|
Yes Yes Yes Yes No Yes No No N... |
Test 23
Verdict: WRONG ANSWER
input |
---|
10 20 2 1 10 6 10 5 5 5 4 4 16 21 70 62 12 30 49 27 64 63 ... |
correct output |
---|
Yes Yes No No Yes Yes Yes Yes ... |
user output |
---|
Yes Yes No No Yes Yes Yes Yes ... |
Test 24
Verdict: WRONG ANSWER
input |
---|
10 20 1 8 9 3 2 6 6 9 5 9 2 13 5 21 25 6 10 45 70 3 15 4... |
correct output |
---|
Yes Yes Yes Yes Yes Yes Yes Ye... |
user output |
---|
Yes Yes Yes Yes Yes Yes Yes Ye... |
Test 25
Verdict: WRONG ANSWER
input |
---|
10 20 10 6 2 10 9 8 7 7 6 3 15 98 23 1 70 26 91 44 64 78 1... |
correct output |
---|
Yes No Yes No No Yes No Yes No... |
user output |
---|
Yes No Yes No No Yes No Yes Ye... |
Test 26
Verdict: ACCEPTED
input |
---|
10 20 2 10 10 4 4 10 10 6 2 8 40 77 36 52 49 30 100 19 81 9 ... |
correct output |
---|
Yes No Yes Yes No Yes No No No... |
user output |
---|
Yes No Yes Yes No Yes No No No... |
Test 27
Verdict: WRONG ANSWER
input |
---|
10 20 10 4 3 9 1 1 4 2 10 6 10 53 61 42 54 34 49 63 83 44 ... |
correct output |
---|
Yes No No Yes No Yes Yes No No... |
user output |
---|
Yes Yes Yes Yes Yes Yes Yes Ye... |
Test 28
Verdict: WRONG ANSWER
input |
---|
10 20 4 8 4 6 10 8 6 10 4 6 27 51 9 8 42 27 2 50 53 68 87 ... |
correct output |
---|
No No No Yes Yes No No Yes No ... |
user output |
---|
No No No Yes Yes No No Yes No ... |
Test 29
Verdict: WRONG ANSWER
input |
---|
10 20 1 10 3 9 4 6 9 3 5 1 62 44 77 41 41 53 88 48 93 56 ... |
correct output |
---|
No Yes No Yes Yes No No Yes No... |
user output |
---|
Yes Yes Yes Yes Yes Yes No Yes... |
Test 30
Verdict: ACCEPTED
input |
---|
10 20 4 6 6 6 2 2 4 2 2 4 88 42 14 25 14 9 40 35 50 17 3... |
correct output |
---|
No No Yes No Yes No No No No N... |
user output |
---|
No No Yes No Yes No No No No N... |
Test 31
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 1000 59286 71521 84428 60278 85796 ... |
correct output |
---|
Yes Yes Yes Yes Yes Yes Yes Ye... |
user output |
---|
(empty) |
Test 32
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 1000 99721 72034 93258 12 12813 302... |
correct output |
---|
Yes Yes Yes Yes Yes Yes Yes Ye... |
user output |
---|
(empty) |
Test 33
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 1000 18509 2593 93156 54968 94775 4... |
correct output |
---|
Yes Yes Yes Yes Yes Yes Yes Ye... |
user output |
---|
(empty) |
Test 34
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 1000 7073 70816 83997 29091 12134 5... |
correct output |
---|
Yes Yes Yes Yes Yes Yes Yes Ye... |
user output |
---|
(empty) |
Test 35
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 1000 90064 54725 17270 97270 85564 ... |
correct output |
---|
Yes Yes Yes Yes Yes Yes Yes Ye... |
user output |
---|
(empty) |
Test 36
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 1000 5520 87074 83134 20672 36374 9... |
correct output |
---|
No No Yes No No Yes Yes No Yes... |
user output |
---|
(empty) |
Test 37
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 1000 94750 33199 20941 82125 6426 4... |
correct output |
---|
Yes Yes Yes Yes Yes Yes Yes Ye... |
user output |
---|
(empty) |
Test 38
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 1000 22734 77994 31898 43842 97824 ... |
correct output |
---|
No Yes No No No Yes No Yes No ... |
user output |
---|
(empty) |
Test 39
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 1000 1112 96856 23945 86921 37753 5... |
correct output |
---|
Yes Yes Yes Yes Yes Yes Yes Ye... |
user output |
---|
(empty) |
Test 40
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 1000 36448 50188 49914 49578 756 13... |
correct output |
---|
Yes Yes No Yes No Yes Yes Yes ... |
user output |
---|
(empty) |
Test 41
Verdict: TIME LIMIT EXCEEDED
input |
---|
200 1000 59286 71521 84428 60278 85796 ... |
correct output |
---|
Yes Yes Yes Yes Yes Yes Yes Ye... |
user output |
---|
(empty) |
Test 42
Verdict: TIME LIMIT EXCEEDED
input |
---|
200 1000 99721 72034 93258 12 12813 302... |
correct output |
---|
Yes Yes No Yes Yes Yes Yes Yes... |
user output |
---|
(empty) |
Test 43
Verdict: TIME LIMIT EXCEEDED
input |
---|
200 1000 18509 2593 93156 54968 94775 4... |
correct output |
---|
Yes Yes Yes Yes Yes Yes Yes Ye... |
user output |
---|
(empty) |
Test 44
Verdict: TIME LIMIT EXCEEDED
input |
---|
200 1000 7073 70816 83997 29091 12134 5... |
correct output |
---|
Yes Yes Yes Yes Yes Yes Yes Ye... |
user output |
---|
(empty) |
Test 45
Verdict: TIME LIMIT EXCEEDED
input |
---|
200 1000 90064 54725 17270 97270 85564 ... |
correct output |
---|
Yes Yes Yes Yes Yes Yes Yes Ye... |
user output |
---|
(empty) |
Test 46
Verdict: TIME LIMIT EXCEEDED
input |
---|
200 1000 5520 87074 83134 20672 36374 9... |
correct output |
---|
No No No No No No No No Yes No... |
user output |
---|
(empty) |
Test 47
Verdict: TIME LIMIT EXCEEDED
input |
---|
200 1000 94750 33199 20941 82125 6426 4... |
correct output |
---|
Yes Yes Yes Yes Yes Yes Yes Ye... |
user output |
---|
(empty) |
Test 48
Verdict: TIME LIMIT EXCEEDED
input |
---|
200 1000 22734 77994 31898 43842 97824 ... |
correct output |
---|
No Yes No No Yes Yes Yes Yes Y... |
user output |
---|
(empty) |
Test 49
Verdict: TIME LIMIT EXCEEDED
input |
---|
200 1000 1112 96856 23945 86921 37753 5... |
correct output |
---|
Yes Yes Yes Yes Yes Yes Yes Ye... |
user output |
---|
(empty) |
Test 50
Verdict: TIME LIMIT EXCEEDED
input |
---|
200 1000 36448 50188 49914 49578 756 13... |
correct output |
---|
Yes Yes No Yes No No No Yes No... |
user output |
---|
(empty) |
Test 51
Verdict: TIME LIMIT EXCEEDED
input |
---|
2000 100000 59286 71521 84428 60278 85796 ... |
correct output |
---|
Yes Yes Yes Yes Yes Yes Yes Ye... |
user output |
---|
(empty) |
Test 52
Verdict: TIME LIMIT EXCEEDED
input |
---|
2000 100000 99721 72034 93258 12 12813 302... |
correct output |
---|
Yes Yes Yes Yes Yes Yes Yes Ye... |
user output |
---|
(empty) |
Test 53
Verdict: TIME LIMIT EXCEEDED
input |
---|
2000 100000 18509 2593 93156 54968 94775 4... |
correct output |
---|
Yes Yes Yes Yes Yes Yes Yes Ye... |
user output |
---|
(empty) |
Test 54
Verdict: TIME LIMIT EXCEEDED
input |
---|
2000 100000 7073 70816 83997 29091 12134 5... |
correct output |
---|
Yes Yes Yes Yes Yes Yes Yes Ye... |
user output |
---|
(empty) |