제출 #284531

#제출 시각아이디문제언어결과실행 시간메모리
284531IOrtroiii팀들 (IOI15_teams)C++14
34 / 100
4089 ms62068 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; const int MX = 500500; int N; int A[MX]; int B[MX]; vector<int> add[MX]; vector<int> sub[MX]; 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]; add[A[i]].emplace_back(i); sub[B[i]+1].emplace_back(i); } } bool delt[MX]; int can(int M, int K[]) { sort(K, K + M); for (int i = 0; i < N; ++i) delt[i] = false; set<pair<int, int>> st; int ptr = 0; for (int i = 0; i < M; ++i) { while (ptr < K[i]) { ++ptr; for (int z : add[ptr]) st.emplace(B[z], z); for (int z : sub[ptr]) if (!delt[z]) st.erase(st.find(make_pair(B[z], z))); } if (st.size() < K[i]) return 0; for (int z = 0; z < K[i]; ++z) { int x = st.begin()->second; st.erase(st.begin()); delt[x] = true; } } return 1; }

컴파일 시 표준 에러 (stderr) 메시지

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