제출 #158352

#제출 시각아이디문제언어결과실행 시간메모리
158352johutha팀들 (IOI15_teams)C++14
0 / 100
4037 ms51776 KiB
#include "teams.h" #include <iostream> #include <vector> #include <set> #include <algorithm> using namespace std; struct event { int tm; bool st = false; bool end = false; int nr = -1; }; bool evsort(event e1, event e2) { if (e1.tm != e2.tm) return e1.tm < e2.tm; if (e1.st) return true; if (e2.st) return false; if (e1.nr == -1) return true; return (e2.nr != -1); } vector<event> evs; vector<int> st; vector<int> en; void init(int N, int A[], int B[]) { for (int i = 0; i < N; i++) { st.push_back(A[i]); en.push_back(B[i]); event nw; nw.tm = A[i]; nw.nr = i; nw.st = true; evs.push_back(nw); event ene; ene.tm = B[i]; ene.nr = i; ene.end = true; evs.push_back(ene); } } int can(int M, int K[]) { vector<event> evcopy = evs; for (int i = 0; i < M; i++) { event mev; mev.tm = K[i]; evcopy.push_back(mev); } sort(evcopy.begin(), evcopy.end(), evsort); multiset<int> active; for (auto e : evcopy) { if (e.nr == -1) { if (active.size() < e.tm) { return 0; } auto it = active.begin(); for (int i = 0; i < e.tm; i++) { it = active.erase(it); } } else if (e.st) { active.insert(en[e.nr]); } else { if (active.find(e.tm) != active.end()) active.erase(active.find(e.tm)); } } return 1; }

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

teams.cpp: In function 'int can(int, int*)':
teams.cpp:66:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if (active.size() < e.tm)
        ~~~~~~~~~~~~~~^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...