結果
問題 | No.2796 Small Matryoshka |
ユーザー |
|
提出日時 | 2024-06-28 21:41:12 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 90 ms / 2,000 ms |
コード長 | 1,075 bytes |
コンパイル時間 | 2,806 ms |
コンパイル使用メモリ | 253,080 KB |
実行使用メモリ | 9,092 KB |
最終ジャッジ日時 | 2024-06-28 21:41:22 |
合計ジャッジ時間 | 4,583 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h> #define mp make_pair #define pb push_back using namespace std; using ll = long long int; template<typename T> ostream& operator+(ostream& out, const vector<T> &vec){ for(const auto &x : vec){ out<<x<<" "; } out<<"\n"; return out; } template<typename T> ostream& operator*(ostream& out, const vector<T> &vec){ for(const auto &x : vec){ out+x; } return out; } template<typename T> istream& operator>>(istream& in, vector<T> &vec){ for(auto &x : vec){ in>>x; } return in; } void solve(){ int n; cin>>n; vector<array<int, 2>> a(n); vector<array<int, 2>> events; for(auto &[r, R] : a){ cin>>r>>R; if(r == R) continue; events.push_back({r, 1}); events.push_back({R, -1}); } sort(events.begin(), events.end()); int ans = 0, cnt = 0; for(auto &[v, p] : events){ cnt += p; ans = max(ans, cnt); } cout<<ans - 1<<"\n"; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); solve(); }