제출 #1034112

#제출 시각아이디문제언어결과실행 시간메모리
1034112fv3팀들 (IOI15_teams)C++17
0 / 100
4104 ms16508 KiB
#include "teams.h"

#include <bits/stdc++.h>
using namespace std;

struct range
{
	int l, r;
	bool operator<(const range other) const 
	{
		return r < other.r || r == other.r && l < other.l;
	}
};

int N;
vector<range> v;

void init(int N_, int A[], int B[]) 
{
	N = N_;
	v.resize(N);

	for (int i = 0; i < N; i++)
	{
		v[i] = {A[i], B[i]};
	}

	sort(v.begin(), v.end());
}

int can(int M, int K_[]) 
{
	map<int, int> K;
	multiset<int> s;
	for (int i = 0; i < M; i++)
	{
		s.insert(K_[i]);
		K[K_[i]] += K_[i];
	}

	for (int i = 0; i < N; i++)
	{
		auto it = s.lower_bound(v[i].l);
		if (it == s.end() || *it > v[i].r) continue;

		if (!--K[*it])
			s.erase(it);
	}

	for (auto e : K)
		if (e.second)
			return 0;

	return 1;
}

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

teams.cpp: In member function 'bool range::operator<(range) const':
teams.cpp:11:38: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   11 |   return r < other.r || r == other.r && l < other.l;
      |                         ~~~~~~~~~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...