Submission #320299

#TimeUsernameProblemLanguageResultExecution timeMemory
320299kaplanbarUntitled (POI11_tem)C++14
0 / 100
265 ms4724 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> v; for(int i = 0; i < n; i++) { int x, y; cin >> x >> y; if(v.empty()) { v.push_back(x); } else { auto it = upper_bound(v.begin(), v.end(), y) - v.begin(); if(it == 0) { v[it] = x; } else { int now = max(v[it - 1], x); if(it == (int)v.size()) v.push_back(now); else if(now < v[it]) v[it] = now; } } } cout << v.size(); 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...