Submission #727708

#TimeUsernameProblemLanguageResultExecution timeMemory
727708Vu_CG_CoderTeams (IOI15_teams)C++14
34 / 100
4086 ms17856 KiB
/* [Author : Hoang Duy Vu] - THPT Chuyen Nguyen Du */ //#pragma GCC optimize(" unroll-loops") //#pragma gcc optimize("Ofast") //#pragma GCC optimization("Ofast") //#pragma optimize(Ofast) #include "teams.h" #include <bits/stdc++.h> #define All(x) (x).begin(),(x).end() #define ll long long #define C make_pair #define fi first #define se second #define two second.first #define thr second.second #define TASK "txt" using namespace std; template<typename T> bool maximize(T &res, const T &val) { if (res < val) { res = val; return true; } return false; } template<typename T> bool minimize(T &res, const T &val) { if (res > val) { res = val; return true; } return false; } typedef pair<int,int> ii; typedef pair<int,ii> iii; const int LOG = 20; const int INF = 1e9 + 7; const ll LNF = 1e18 + 7; const int mod = 1e9 + 7; const int Nx = 1e5 + 100; multiset <int> s; ii a[Nx]; vector <int> in[Nx] , out[Nx]; int n; int m; void init(int N, int A[], int B[]) { n = N; for (int i = 0 ; i < n ; i++) { in[B[i]].push_back(A[i]); out[A[i] - 1].push_back(A[i]); } } int can(int M, int K[]) { m = M; sort(K,K+m); s.clear(); int r = m - 1; for (int i = n ; i >= 0 ; i--) { for (int v : in[i]) s.insert(v); while (!s.empty()) { auto x = s.end(); x--; if ((*x) > i) s.erase(s.find(*x)); else break; } // cout << i << ": "; // for (int v : s) cout << v << " "; // cout << "\n"; while (r >= 0 && K[r] == i) { if (s.size() < i) return 0; for (int j = 1 ; j <= i ; j++) { auto x = s.end(); x--; s.erase(s.find(*x)); } r--; } } return 1; } // int main() // { // ios_base::sync_with_stdio(0); // cin.tie(NULL); cout.tie(NULL); // if(fopen(TASK".inp", "r")){ // freopen(TASK".inp","r",stdin); // freopen(TASK".out","w",stdout); // } // int A[10] , B[10]; // int p; // cin >> p; // for (int i = 0 ; i < p ; i++) cin >> A[i] >> B[i]; // init(p,A,B); // int q; // cin >> q; // while (q--) // { // int k[10]; // int x; // cin >> x; // for (int i = 0 ; i < x ; i++) cin >> k[i]; // cout << can(x,k) << "\n"; // } // return 0; // }

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:72:26: warning: comparison of integer expressions of different signedness: 'std::multiset<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   72 |             if (s.size() < 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...