Submission #1317644


Source Code Expand

#include <iostream>
#include <queue>
#include <vector>
#include <functional>

using namespace std;

typedef pair<int, int> P;

int main() {
	int n;
	cin >> n;
	int s, t;
	priority_queue<P, vector<P>, greater<P> > pq;
	for (int i = 0; i < n; i++) {
		cin >> s >> t;
		pq.push(P(t, s));
	}
	int ans, nn;
	ans = nn = 0;
	while (nn < n - 1) {
		ans++;
		priority_queue<P, vector<P>, greater<P> > pq2;
		while (!pq.empty()) {
			P p = pq.top();
			pq.pop();
			nn++;
			while (!pq.empty()) {
				P pp = pq.top();
				pq.pop();
				if (pp.second >= p.first) {
					nn++;
					p = pp;
				}
				else {
					pq2.push(pp);
				}
			}
		}
		pq = pq2;
	}
	cout << ans << endl;
	return 0;
}

Submission Info

Submission Time
Task D - 足ゲームII
User scor
Language C++14 (GCC 5.4.1)
Score 0
Code Size 721 Byte
Status WA
Exec Time 2103 ms
Memory 2896 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 100
Status
AC × 3
AC × 14
WA × 3
TLE × 17
Set Name Test Cases
Sample sample-01.txt, sample-02.txt, sample-03.txt
All sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, 01-26.txt, 01-27.txt, 01-28.txt, sample-01.txt, sample-02.txt, sample-03.txt
Case Name Status Exec Time Memory
01-01.txt AC 1 ms 256 KB
01-02.txt AC 1 ms 256 KB
01-03.txt AC 1 ms 256 KB
01-04.txt WA 11 ms 256 KB
01-05.txt TLE 2103 ms 2880 KB
01-06.txt TLE 2103 ms 2880 KB
01-07.txt TLE 2103 ms 2880 KB
01-08.txt TLE 2103 ms 2880 KB
01-09.txt TLE 2103 ms 2880 KB
01-10.txt WA 1 ms 256 KB
01-11.txt TLE 2103 ms 2884 KB
01-12.txt TLE 2103 ms 2880 KB
01-13.txt TLE 2103 ms 2884 KB
01-14.txt TLE 2103 ms 2884 KB
01-15.txt WA 41 ms 256 KB
01-16.txt TLE 2103 ms 2880 KB
01-17.txt TLE 2103 ms 2880 KB
01-18.txt TLE 2103 ms 2880 KB
01-19.txt TLE 2103 ms 2880 KB
01-20.txt AC 65 ms 256 KB
01-21.txt TLE 2103 ms 2892 KB
01-22.txt TLE 2103 ms 2896 KB
01-23.txt TLE 2103 ms 2896 KB
01-24.txt TLE 2103 ms 2896 KB
01-25.txt AC 1 ms 256 KB
01-26.txt AC 1 ms 256 KB
01-27.txt AC 69 ms 1400 KB
01-28.txt AC 69 ms 1400 KB
sample-01.txt AC 1 ms 256 KB
sample-02.txt AC 1 ms 256 KB
sample-03.txt AC 1 ms 256 KB