Submission #772392

#TimeUsernameProblemLanguageResultExecution timeMemory
772392phoebeTeams (IOI15_teams)C++17
34 / 100
4062 ms136308 KiB
#include <bits/stdc++.h> #include "teams.h" using namespace std; #define ll long long #define pii pair<int, int> #define F first #define S second #define FOR(i, n) for (int i = 0; i < n; i++) #define PB push_back const int maxn = 5e5 + 10; int n; map<int, vector<pii>> add, addnt; bool cmp(pii a, pii b){ return a.S < b.S; } void init(int N, int A[], int B[]){ n = N; FOR(i, n){ add[A[i]].PB({B[i], i}); addnt[B[i]].PB({B[i], i}); } } int can(int m, int k[]){ map<int, int> need; FOR(i, m) need[k[i]] += k[i]; set<pii> s; for (int i = 1; i <= n; i++){ for (auto x : add[i]) s.insert(x); if (s.size() < need[i]) return 0; FOR(_, need[i]) s.erase(s.begin()); for (auto x : addnt[i]){ if (s.count(x)) s.erase(x); } } return 1; }

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:35:22: warning: comparison of integer expressions of different signedness: 'std::set<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'std::map<int, int>::mapped_type' {aka 'int'} [-Wsign-compare]
   35 |         if (s.size() < need[i]) return 0;
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...