Submission #1564974


Source Code Expand

#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "random"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 0.00000001;
const long double PI = 3.1415926535897932384626433;

long long int N, M, K, L, R, H, W;



int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> N >> M;
	vector < pair<int, int>>place(M);
	for (int i = 0; i < M; i++) {
		cin >> place[i].first >> place[i].second;
	}
	int l[101] = {};
	for (int i = 0; i < M; i++) {
		l[place[i].first] = max(l[place[i].first], place[i].second);
	}
	for (int i = 1; i < N; i++) {
		l[i] = max(l[i], l[i - 1]);
	}
	int box = 0;
	int ans = 0;
	while (box < N) {
		if (l[box + 1] <= box + 1) {
			cout << "Impossible\n";
			return 0;
		}
		box = l[box + 1];
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Submission Info

Submission Time
Task D - 権力
User olphe
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1011 Byte
Status WA
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 39
WA × 14
Set Name Test Cases
All 00_sample_1, 00_sample_2, 00_teuchi_1, 00_teuchi_2, 00_teuchi_3, 00_teuchi_4, 10_max1_06, 10_max1_07, 10_max1_08, 10_max1_09, 10_max1_10, 10_max1_11, 10_max1_12, 10_max2_13, 10_max2_14, 10_max2_15, 10_max2_16, 10_max2_17, 10_max2_18, 10_max2_19, 10_max2_20, 10_max2_21, 10_max2_22, 10_min_00, 10_min_01, 10_min_02, 10_min_03, 10_min_04, 10_min_05, 10_rand_27, 10_rand_28, 10_rand_29, 10_rand_30, 10_rand_31, 10_rand_32, 10_rand_33, 10_rand_34, 10_rand_35, 10_rand_36, 10_rand_37, 10_rand_38, 10_rand_39, 10_rand_40, 10_rand_41, 10_rand_42, 10_rand_43, 10_rand_44, 10_rand_45, 10_rand_46, 10_unif_23, 10_unif_24, 10_unif_25, 10_unif_26
Case Name Status Exec Time Memory
00_sample_1 AC 1 ms 256 KB
00_sample_2 AC 1 ms 256 KB
00_teuchi_1 AC 1 ms 256 KB
00_teuchi_2 AC 1 ms 256 KB
00_teuchi_3 AC 1 ms 256 KB
00_teuchi_4 AC 1 ms 256 KB
10_max1_06 AC 1 ms 256 KB
10_max1_07 AC 1 ms 256 KB
10_max1_08 AC 1 ms 256 KB
10_max1_09 WA 1 ms 256 KB
10_max1_10 AC 1 ms 256 KB
10_max1_11 WA 1 ms 256 KB
10_max1_12 AC 1 ms 256 KB
10_max2_13 AC 1 ms 256 KB
10_max2_14 AC 1 ms 256 KB
10_max2_15 AC 1 ms 256 KB
10_max2_16 WA 1 ms 256 KB
10_max2_17 WA 1 ms 256 KB
10_max2_18 AC 1 ms 256 KB
10_max2_19 AC 1 ms 256 KB
10_max2_20 AC 1 ms 256 KB
10_max2_21 AC 1 ms 256 KB
10_max2_22 WA 1 ms 256 KB
10_min_00 WA 1 ms 256 KB
10_min_01 WA 1 ms 256 KB
10_min_02 AC 1 ms 256 KB
10_min_03 AC 1 ms 256 KB
10_min_04 AC 1 ms 256 KB
10_min_05 WA 1 ms 256 KB
10_rand_27 AC 1 ms 256 KB
10_rand_28 AC 1 ms 256 KB
10_rand_29 AC 1 ms 256 KB
10_rand_30 AC 1 ms 256 KB
10_rand_31 AC 1 ms 256 KB
10_rand_32 WA 1 ms 256 KB
10_rand_33 AC 1 ms 256 KB
10_rand_34 AC 1 ms 256 KB
10_rand_35 WA 1 ms 256 KB
10_rand_36 WA 1 ms 256 KB
10_rand_37 AC 1 ms 256 KB
10_rand_38 AC 1 ms 256 KB
10_rand_39 AC 1 ms 256 KB
10_rand_40 WA 1 ms 256 KB
10_rand_41 WA 1 ms 256 KB
10_rand_42 AC 1 ms 256 KB
10_rand_43 AC 1 ms 256 KB
10_rand_44 AC 1 ms 256 KB
10_rand_45 AC 1 ms 256 KB
10_rand_46 AC 1 ms 256 KB
10_unif_23 WA 1 ms 256 KB
10_unif_24 AC 1 ms 256 KB
10_unif_25 AC 1 ms 256 KB
10_unif_26 AC 1 ms 256 KB