結果
問題 | No.2796 Small Matryoshka |
ユーザー | 矢澤式WINTER |
提出日時 | 2024-06-28 22:33:30 |
言語 | C++23 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 112 ms / 2,000 ms |
コード長 | 1,500 bytes |
コンパイル時間 | 3,105 ms |
コンパイル使用メモリ | 253,524 KB |
実行使用メモリ | 9,488 KB |
最終ジャッジ日時 | 2024-06-28 22:33:35 |
合計ジャッジ時間 | 4,372 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,812 KB |
testcase_01 | AC | 1 ms
6,944 KB |
testcase_02 | AC | 2 ms
6,944 KB |
testcase_03 | AC | 1 ms
6,940 KB |
testcase_04 | AC | 1 ms
6,944 KB |
testcase_05 | AC | 15 ms
6,944 KB |
testcase_06 | AC | 91 ms
8,772 KB |
testcase_07 | AC | 2 ms
6,944 KB |
testcase_08 | AC | 75 ms
9,488 KB |
testcase_09 | AC | 112 ms
9,224 KB |
testcase_10 | AC | 98 ms
9,224 KB |
testcase_11 | AC | 102 ms
9,096 KB |
testcase_12 | AC | 40 ms
6,944 KB |
testcase_13 | AC | 6 ms
6,940 KB |
testcase_14 | AC | 34 ms
6,940 KB |
testcase_15 | AC | 10 ms
6,940 KB |
testcase_16 | AC | 17 ms
6,940 KB |
testcase_17 | AC | 64 ms
6,944 KB |
testcase_18 | AC | 72 ms
9,128 KB |
testcase_19 | AC | 22 ms
6,940 KB |
testcase_20 | AC | 31 ms
6,940 KB |
testcase_21 | AC | 62 ms
6,944 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; /*/ #include <atcoder/all> using namespace atcoder; #pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #pragma GCC target("avx,avx2,fma") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma") //*/ #define rep(i,n) for(int i=0;i<n;i++) #define Rep(i,a,b) for(int i=a;i<b;i++) #define ALL(x) (x).begin(),(x).end() #define dbgv(x); for(auto now : x) cout << now << " "; cout << endl; //using P = pair<int,int>; using ll = long long; using ull = unsigned long long; //*/ template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<ll> vll; typedef vector<int> vint; random_device rnd; mt19937 rng(rnd()); void solve(){ int n; cin >> n; int ans = 0; vector<pair<int,int>> ps(n); rep(i,n) cin >> ps[i].first >> ps[i].second; priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq; rep(i,n){ pq.push(make_pair(ps[i].first,1)); pq.push(make_pair(ps[i].second,-1)); } int cnt = 0; while(!pq.empty()){ auto [u,id] = pq.top(); pq.pop(); cnt += id; chmax(ans,cnt); } cout << ans-1 << endl; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t = 1; //cin >> t; rep(testcase,t) solve(); }