Submission #798714

# Submission time Handle Problem Language Result Execution time Memory
798714 2023-07-31T01:31:42 Z tlnk07 Osumnjičeni (COCI21_osumnjiceni) C++17
0 / 110
1000 ms 2724 KB
#include<bits/stdc++.h>
using namespace std;

long long n, q, x, y;
vector<pair<int, int>> vec;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);	cout.tie(NULL);
	cin >> n;
	for(int i = 1; i <= n; ++i)
	{
		cin >> x >> y;
		vec.push_back({x, y});
	}
	cin >> q;
	while(q--)
	{
		cin >> x >> y;
		vec.push_back({INT_MAX, INT_MAX});
		sort(vec.begin(), vec.end());
		long long cnt = 0;
		pair<int, int> t;
		while(vec.size() > 1)
		{
			t = vec[0];
			vec.erase(vec.begin() + 0);
			while(t.first != INT_MAX)
			{
				int l = 0, r = vec.size() - 1;
				while(l < r)
				{
					long long mid = (l + r) / 2;
					if(vec[mid].first <= t.second)	l = mid + 1;
					else	r = mid;
				}
				if(vec[l].first == INT_MAX || vec[l].first <= t.second)	break;
				t = vec[l];
				vec.erase(vec.begin() + l);
			}
			++cnt;
		}
		cout << cnt << "\n";
	}
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 2688 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 464 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 464 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1057 ms 2724 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 2688 KB Time limit exceeded
2 Halted 0 ms 0 KB -