Submission #00071


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()
#define fol(i,s,g) for(int i=(int)(s); i<(int)(g); i++)
#define fix(ans,k) fixed << setprecision(k) << (double)ans
#define total(n) n*(n+1)/2
#define lcm(a,b) (a/__gcd(a,b)*b)
#define mod 1000000007
int main(){
int h, m, N, M;
cin >> h >> m;
cin >> N;
vector<pair<int,int>> ab(N);
fol(i,0,N) cin >> ab[i].first >> ab[i].second;
cin >> M;
vector<pair<int,int>> cd(M);
fol(i,0,M) cin >> cd[i].first >> cd[i].second;
sort(all(ab));
sort(all(cd));
int n_h = ab[0].first, n_w = ab[0].second;
n_w += 11; n_h += n_w / 60; n_w %= 60;
bool ch = true;
fol(i,0,M){
if (n_h < cd[i].first && ch) {
n_h = cd[i].first;
n_w = cd[i].second;
ch = false;
} else if (n_h == cd[i].first && n_w <= cd[i].second && ch) {
n_h = cd[i].first;
n_w = cd[i].second;
ch = false;
}
}
n_w += 10; n_h += n_w / 60; n_w %= 60;
if (n_h < h && !ch) cout << "1\n";
else if (n_h == h && n_w <= m && !ch) cout << "1\n";
else cout << "0\n";
//cout << n_h << ':' << n_w << '\n';
return 0;
}

ステータス

項目 データ
問題 0010 - 乗り継ぎ
ユーザー名 ei2109
投稿日時 2022-08-30 09:57:32
言語 C++17
状態 Accepted
得点 10
ソースコード長 1288 Byte
最大実行時間 29 ms
最大メモリ使用量 608 KB

セット

セット 得点 Cases
1 ALL 10 / 10 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in1 AC 22 ms 476 KB
1
in2 AC 16 ms 528 KB
1
in3 AC 23 ms 440 KB
1
in4 AC 16 ms 544 KB
1
in5 AC 24 ms 512 KB
1
in6 AC 29 ms 488 KB
1
in7 AC 23 ms 456 KB
1
in8 AC 20 ms 432 KB
1
in9 AC 23 ms 528 KB
1
in10 AC 22 ms 572 KB
1
in11 AC 18 ms 540 KB
1
in12 AC 24 ms 384 KB
1
in13 AC 20 ms 608 KB
1
in14 AC 25 ms 576 KB
1
in15 AC 17 ms 420 KB
1
in16 AC 27 ms 516 KB
1
in17 AC 20 ms 492 KB
1
in18 AC 23 ms 456 KB
1
in19 AC 22 ms 428 KB
1
in20 AC 20 ms 500 KB
1
in21 AC 24 ms 472 KB
1