結果
問題 |
No.365 ジェンガソート
|
ユーザー |
|
提出日時 | 2023-02-15 22:56:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 29 ms / 2,000 ms |
コード長 | 1,028 bytes |
コンパイル時間 | 3,326 ms |
コンパイル使用メモリ | 229,784 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-18 05:36:34 |
合計ジャッジ時間 | 5,861 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 41 |
ソースコード
#include <bits/stdc++.h> #include <math.h> #include <algorithm> #include <array> #include <atcoder/all> #include <bitset> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <sstream> #include <vector> using namespace std; using namespace atcoder; using Graph = vector<vector<int>>; using ll = long long; typedef pair<ll, ll> P_ll; typedef pair<int, int> P; const ll INF_ll = 1e17; const int INF = 1e8; template <class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; } template <typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>; int main() { int N; cin >> N; vector<int> a(N); for (int i = 0; i < N; i++) { cin >> a[i]; } int ans = 0; int max = 0; for (int i = 0; i < N; i++) { if (a[i] < max) { chmax(ans, a[i]); } chmax(max, a[i]); } cout << ans << endl; return 0; }