제출 #899445

#제출 시각아이디문제언어결과실행 시간메모리
899445Ice_manAdvertisement 2 (JOI23_ho_t2)C++14
100 / 100
143 ms18156 KiB
#include <iostream> #include <chrono> #include <vector> #include <algorithm> #define maxn 500005 #define maxlog 20 #define INF 1000000010 #define LINF 1000000000000000005 #define endl '\n' #define pb(x) push_back(x) #define X first #define Y second #define control cout<<"passed"<<endl; #pragma GCC optimize("O3" , "Ofast" , "unroll-loops" , "fast-math") #pragma GCC target("avx2") using namespace std; std::chrono::high_resolution_clock::time_point startT, currT; constexpr double TIME_MULT = 1; double timePassed() { using namespace std::chrono; currT = high_resolution_clock::now(); double time = duration_cast<duration<double>>(currT - startT).count(); return time * TIME_MULT; } int n; int a[maxn]; int p[maxn]; vector <pair <int , int >> res; bool cmp(pair <int , int> e1 , pair <int , int> e2) { return e1.X != e2.X? e1.X < e2.X : e1.Y > e2.Y; } void read() { cin >> n; res.resize(n); for(int i = 0; i < n; i++) cin >> a[i] >> p[i]; for(int i = 0; i < n; i++) { res[i].X = a[i] - p[i]; res[i].Y = a[i] + p[i]; } sort(res.begin() , res.end() , cmp); int maxx = -1 , br = 0; for(pair <int , int> e : res) if(e.Y > maxx) { maxx = e.Y; br++; } cout << br << endl; } int main() { /**#ifdef ONLINE_JUDGE freopen("taxi.in", "r", stdin); freopen("taxi.out", "w", stdout); #endif*/ ios_base::sync_with_stdio(false); cin.tie(nullptr); startT = std::chrono::high_resolution_clock::now(); read(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...