Submission #604301

#TimeUsernameProblemLanguageResultExecution timeMemory
6043018e7Teams (IOI15_teams)C++17
34 / 100
4099 ms8952 KiB
//Challenge: Accepted #include <bits/stdc++.h> using namespace std; #ifdef zisk void debug(){cout << endl;} template<class T, class ... U> void debug(T a, U ... b){cout << a << " ", debug(b...);} template<class T> void pary(T l, T r){ while (l != r) cout << *l << " ", l++; cout << endl; } #else #define debug(...) 0 #define pary(...) 0 #endif #define ll long long #define maxn 500005 #define pii pair<int, int> #define ff first #define ss second #include "teams.h" pii a[maxn]; int n; void init(int N, int A[], int B[]) { n = N; for (int i = 0;i < n;i++) a[i] = {A[i], B[i]}; sort(a, a + n, [&](pii p, pii q){return p.ss < q.ss;}); } int can(int m, int num[]) { map<int, int> mp; for (int i = 0;i < m;i++) mp[num[i]] += num[i]; for (int i = 0;i < n;i++) { auto it = mp.lower_bound(a[i].ff); if (it == mp.end() || it->ff > a[i].ss) continue; debug(it->ff, it->ss); it->ss -= 1; if (it->ss == 0) mp.erase(it); } if (mp.size() == 0) return 1; else return 0; }

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:12:20: warning: statement has no effect [-Wunused-value]
   12 | #define debug(...) 0
      |                    ^
teams.cpp:37:3: note: in expansion of macro 'debug'
   37 |   debug(it->ff, it->ss);
      |   ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...