Submission #3817098
Source Code Expand
#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <string> #include <sstream> #include <complex> #include <vector> #include <list> #include <queue> #include <deque> #include <stack> #include <map> #include <set> #include <iomanip> using namespace std; typedef long long unsigned int ll; template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>; #define EPS (1e-7) #define INF (1e15) #define PI (acos(-1)) #define MOD 1000000007 #define REP(i,n) for(int i=0;i<n;i++) #define REPS(i,f,n) for(int i=(f);i<(n);i++) #define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++) #define dump(x) cout << #x << " = " << (x) << endl; #define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; typedef pair<int, int> P; typedef pair<ll, ll> LP; typedef pair<int, P> PP; typedef pair<ll, LP> LPP; int dy4[]={0, 0, 1, -1}; int dx4[]={1, -1, 0, 0}; int dx8[]={0, 0, 1, -1, 1, 1, -1, -1}; int dy8[]={1, -1, 0, 0, 1, -1, -1, 1}; // https://atcoder.jp/contests/abc103/tasks/abc103_d int main() { int N, M; cin >> N >> M; vector<P> ab; REP(i, M) { int a, b; cin >> a >> b; ab.push_back({b,a}); } sort(ab.begin(), ab.end()); int now = 0; int ans = 0; for (P p : ab) { int right = p.first; int left = p.second; if (left >= now) { now = right; ans++; } } cout << ans << "\n"; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Islands War |
User | wakamenod |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 1614 Byte |
Status | AC |
Exec Time | 66 ms |
Memory | 1400 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01, sample_02, sample_03 |
All | 0_small_0, 0_small_1, 0_small_10, 0_small_2, 0_small_3, 0_small_4, 0_small_5, 0_small_6, 0_small_7, 0_small_8, 0_small_9, 1_rand_0, 1_rand_1, 1_rand_2, 1_rand_3, 1_rand_4, 1_rand_5, 1_rand_6, 1_rand_7, 1_rand_8, 1_rand_9, 2_max_0, 2_max_1, 2_max_2, 2_max_3, 2_max_4, 2_max_5, 2_max_6, 2_max_7, 2_max_8, 2_max_9, 3_nosub_0, 3_nosub_1, 3_nosub_2, 3_nosub_3, 3_nosub_4, 3_nosub_5, 3_nosub_6, 3_nosub_7, 3_nosub_8, 3_nosub_9, sample_01, sample_02, sample_03 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_small_0 | AC | 1 ms | 256 KB |
0_small_1 | AC | 1 ms | 256 KB |
0_small_10 | AC | 1 ms | 256 KB |
0_small_2 | AC | 1 ms | 256 KB |
0_small_3 | AC | 1 ms | 256 KB |
0_small_4 | AC | 1 ms | 256 KB |
0_small_5 | AC | 1 ms | 256 KB |
0_small_6 | AC | 1 ms | 256 KB |
0_small_7 | AC | 1 ms | 256 KB |
0_small_8 | AC | 1 ms | 256 KB |
0_small_9 | AC | 1 ms | 256 KB |
1_rand_0 | AC | 4 ms | 384 KB |
1_rand_1 | AC | 25 ms | 892 KB |
1_rand_2 | AC | 57 ms | 1400 KB |
1_rand_3 | AC | 63 ms | 1400 KB |
1_rand_4 | AC | 10 ms | 512 KB |
1_rand_5 | AC | 49 ms | 1400 KB |
1_rand_6 | AC | 27 ms | 892 KB |
1_rand_7 | AC | 45 ms | 1400 KB |
1_rand_8 | AC | 19 ms | 640 KB |
1_rand_9 | AC | 53 ms | 1400 KB |
2_max_0 | AC | 64 ms | 1400 KB |
2_max_1 | AC | 64 ms | 1400 KB |
2_max_2 | AC | 64 ms | 1400 KB |
2_max_3 | AC | 64 ms | 1400 KB |
2_max_4 | AC | 64 ms | 1400 KB |
2_max_5 | AC | 64 ms | 1400 KB |
2_max_6 | AC | 64 ms | 1400 KB |
2_max_7 | AC | 64 ms | 1400 KB |
2_max_8 | AC | 64 ms | 1400 KB |
2_max_9 | AC | 64 ms | 1400 KB |
3_nosub_0 | AC | 65 ms | 1400 KB |
3_nosub_1 | AC | 65 ms | 1400 KB |
3_nosub_2 | AC | 65 ms | 1400 KB |
3_nosub_3 | AC | 66 ms | 1400 KB |
3_nosub_4 | AC | 65 ms | 1400 KB |
3_nosub_5 | AC | 65 ms | 1400 KB |
3_nosub_6 | AC | 65 ms | 1400 KB |
3_nosub_7 | AC | 65 ms | 1400 KB |
3_nosub_8 | AC | 65 ms | 1400 KB |
3_nosub_9 | AC | 65 ms | 1400 KB |
sample_01 | AC | 1 ms | 256 KB |
sample_02 | AC | 1 ms | 256 KB |
sample_03 | AC | 1 ms | 256 KB |