제출 #833012

#제출 시각아이디문제언어결과실행 시간메모리
833012beepbeepsheepAdvertisement 2 (JOI23_ho_t2)C++17
100 / 100
134 ms24776 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef tree<long long, null_type, less_equal<>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; #define ll long long #define ii pair<ll,ll> #ifndef DEBUG #define cerr if (0) cerr #define endl '\n' #endif const ll inf=1e15; const ll maxn=5e5+5; const ll mod=1e9+7; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); ii arr[maxn]; stack<ii> s; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); ll n,a,b; cin>>n; for (int i=0;i<n;i++){ cin>>arr[i].first>>arr[i].second; } sort(arr,arr+n); for (int i=0;i<n;i++){ while (s.size() && arr[i].first-s.top().first <=arr[i].second-s.top().second) s.pop(); if (s.size() && arr[i].first-s.top().first<=s.top().second-arr[i].second) continue; s.emplace(arr[i]); } cout<<s.size(); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int main()':
Main.cpp:29:7: warning: unused variable 'a' [-Wunused-variable]
   29 |  ll n,a,b;
      |       ^
Main.cpp:29:9: warning: unused variable 'b' [-Wunused-variable]
   29 |  ll n,a,b;
      |         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...