Submission #00093


ソースコード

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <bits/stdc++.h>
using namespace std;
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
// #define int long long
struct IoSetup {
IoSetup() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(10);
cerr << fixed << setprecision(10);
}
}IoSetup;
using Int = __int128_t;
using ll = long long;
using pii = pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int SMOD = 1000000007;
constexpr int NMOD = 998244353;
constexpr int dx[]={1,0,-1,0,1,1,-1,-1};
constexpr int dy[]={0,-1,0,1,-1,1,-1,1};
inline bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>bool chmax(T &a, const T&b){if(a<b)return(a=b,1);return 0;}
template<class T>bool chmin(T &a, const T&b){if(b<a)return(a=b,1);return 0;}
int mostR[100100];
signed main() {
int w, h, n;
cin >> w >> h >> n;
int mx = 0, my = 0;
for(int i = 0; i < n; i++) {
int x, y;
cin >> x >> y;
chmax(mx, x);
chmax(my, y);
chmax(mostR[y], x);
}
for(int i = my - 1; i >= 0; i--) {
chmax(mostR[i], mostR[i+1]);
}
int ans = my;
for(int i = 0; i < my; i++) {
chmin(ans, i + mostR[i+1]);
}
cout << ans << endl;
return 0;
}

ステータス

項目 データ
問題 0008 - ダンジョン
ユーザー名 社会主義共和国連邦
投稿日時 2020-08-25 16:13:48
言語 C++17
状態 Accepted
得点 11
ソースコード長 1434 Byte
最大実行時間 95 ms
最大メモリ使用量 9588 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in1.txt AC 33 ms 476 KB
1
in2.txt AC 20 ms 1840 KB
1
in3.txt AC 20 ms 7972 KB
1
in4.txt AC 19 ms 9020 KB
1
in5.txt AC 25 ms 9228 KB
1
in6.txt AC 25 ms 9180 KB
1
in7.txt AC 20 ms 9260 KB
1
in8.txt AC 21 ms 9208 KB
1
in9.txt AC 33 ms 9284 KB
1
in10.txt AC 23 ms 688 KB
1
in11.txt AC 15 ms 640 KB
1
in12.txt AC 31 ms 596 KB
1
in13.txt AC 19 ms 552 KB
1
in14.txt AC 51 ms 632 KB
1
in15.txt AC 22 ms 584 KB
1
in16.txt AC 18 ms 656 KB
1
in17.txt AC 41 ms 732 KB
1
in18.txt AC 41 ms 1184 KB
1
in19.txt AC 95 ms 2148 KB
1
in20.txt AC 35 ms 3072 KB
1
in21.txt AC 45 ms 3788 KB
1
in22.txt AC 35 ms 5336 KB
1
in23.txt AC 24 ms 5920 KB
1
in24.txt AC 23 ms 5484 KB
1
in25.txt AC 34 ms 6976 KB
1
in26.txt AC 82 ms 7884 KB
1
in27.txt AC 22 ms 8268 KB
1
in28.txt AC 42 ms 8216 KB
1
in29.txt AC 50 ms 8288 KB
1
in30.txt AC 37 ms 9588 KB
1