Submission #564438

#TimeUsernameProblemLanguageResultExecution timeMemory
564438hoanghq2004Teams (IOI15_teams)C++14
34 / 100
4049 ms18204 KiB
#include <bits/stdc++.h> #pragma GCC optimize ("O3") #pragma GCC optimize ("unroll-loops") #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include "teams.h" using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>; const int N = 2e5 + 10; int n, q, a[N], b[N]; void init(int _n, int A[], int B[]) { n = _n; for (int i = 0; i < n; ++i) a[i] = A[i], b[i] = B[i]; } int can(int m, int x[]) { vector <tuple <int, int, int>> events; set <pair <int, int>> s; for (int i = 0; i < m; ++i) events.push_back({x[i], 0, i}); for (int i = 0; i < n; ++i) { events.push_back({a[i], -1, i}); events.push_back({b[i], 1, i}); } sort(events.begin(), events.end()); for (auto [x, sign, i]: events) { if (sign == 0) { int cur = 0; while (cur < x) { if (s.empty()) { return 0; } s.erase(s.begin()); ++cur; } } else if (sign == -1) s.insert({b[i], i}); else s.erase({b[i], i}); } return 1; } // //int main() { // ios :: sync_with_stdio(0); cin.tie(0); // cin >> n; // int A[n], B[n]; // for (int i = 0; i < n; ++i) cin >> A[i] >> B[i]; // cin >> q; // init(n, A, B); // while (q--) { // int m; // cin >> m; // int K[m]; // for (int i = 0; i < m; ++i) cin >> K[i]; // cout << can(m, K) << '\n'; // } //}

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:33:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   33 |     for (auto [x, sign, i]: events) {
      |               ^
teams.cpp:33:16: warning: declaration of 'auto x' shadows a parameter [-Wshadow]
   33 |     for (auto [x, sign, i]: events) {
      |                ^
teams.cpp:23:20: note: shadowed declaration is here
   23 | int can(int m, int x[]) {
      |                ~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...