結果

問題 No.3797 Express Elevators and Emergency Stairs
ユーザー Nihonielse
提出日時 2026-11-12 15:18:48
言語 C++23(gcc16)
(gcc 16.2.0 + boost 1.92.0 + ACL)
コンパイル:
g++-16 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc16.so -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 118 ms / 2,000 ms
+ 682µs
コード長 3,338 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,828 ms
コンパイル使用メモリ 363,164 KB
実行使用メモリ 9,864 KB
最終ジャッジ日時 2026-11-13 22:07:27
合計ジャッジ時間 6,685 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#line 1 "lib/core.hpp"
// Library and Editor Setting is here: https://github.com/Nihonielse/competitive-library

#ifndef CORE_FILE
#define CORE_FILE

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ull = unsigned long long;

#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n, s) for (int i = s; i < n; i++)

#define vall(v) v.begin(), v.end()

constexpr int INF = 1 << 30;
constexpr int NEG_INF = -INF;
constexpr ll LINF = 1ll << 62;
constexpr ll NEG_LINF = -LINF;

template <typename T> inline bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template <typename T> inline bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <typename T>
using min_priority_queue = priority_queue<T,vector<T>,greater<T>>;

#endif
#line 1 "lib/inout.hpp"



#line 1 "lib/core.hpp"
// Library and Editor Setting is here: https://github.com/Nihonielse/competitive-library

#ifndef CORE_FILE
#define CORE_FILE

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ull = unsigned long long;

#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n, s) for (int i = s; i < n; i++)

#define vall(v) v.begin(), v.end()

constexpr int INF = 1 << 30;
constexpr int NEG_INF = -INF;
constexpr ll LINF = 1ll << 62;
constexpr ll NEG_LINF = -LINF;

template <typename T> inline bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template <typename T> inline bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <typename T>
using min_priority_queue = priority_queue<T,vector<T>,greater<T>>;

#endif
#line 5 "lib/inout.hpp"

inline void yn(const bool &tf) {
    if(tf)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

inline void YN(const bool &tf) {
    if(tf)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

inline void Yes() { cout << "Yes" << endl; }
inline void YES() { cout << "YES" << endl; }
inline void No() { cout << "No" << endl; }
inline void NO() { cout << "NO" << endl; }

template <typename T,typename S>
istream& operator>>(istream& is,pair<T,S>& pa){
    is >> pa.first >> pa.second;
    return is;
}

template <typename T,typename S>
ostream& operator<<(ostream& os,pair<T,S>& pa){
    os << pa.first << " " << pa.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is,vector<T>& vec){
    for(T& item:vec){
        is >> item;
    }
    return is;
}

template <typename T>
ostream& operator<<(ostream& os,vector<T>& vec){
    for(int i=0;i<vec.size();i++){
        if(i) os << " ";
        os << vec[i];
    }
    return os;
}
template <typename T>
ostream& operator<<(ostream& os,vector<vector<T>>& vec){
    for(int i=0;i<vec.size();i++){
        os << vec[i];
        if(i<vec.size()-1)os << endl;
    }
    return os;
}

template <typename T,typename S>
ostream& operator<<(ostream& os,vector<pair<T,S>>& vec){
    for(int i=0;i<vec.size();i++){
        os << vec[i];
        if(i<vec.size()-1)os << endl;
    }
    return os;
}


#line 3 "codes/A.cpp"

int main(){
	int n;
	cin>>n;
	vector<pair<int,int>> elev(n);
	cin>>elev;
	sort(vall(elev));
	int ans=1;
	rep(i,n){
		if(elev[i].first>ans)break;
		chmax(ans,elev[i].second);
	}
	cout<<ans<<endl;
}

0