This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>
#define ios ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0);
#define S second
#define F first
#define pb push_back
#define nl '\n'
#define mp make_pair
#define NL cout << '\n';
#define EX exit(0)
#define all(s) s.begin(), s.end()
#define ll long long
#define lp(i, start, finish) for(int i = start; i <= finish; i++)
#define y1 ljdalsdfjak
const long long MXN = 1e6 + 1;
const long long MNN = 3 * 1e3 + 1;
const long long MOD = 1e9 + 7;
const long long INF = 1e16 + 1;
const long long OO = 1e15;
typedef long long llong;
typedef unsigned long long ullong;
using namespace std;
llong n, b[MXN], cnt = 1, mx;
pair<int, int> p[MXN];
int main(){
ios;
cin >> n;
for(int i = 1; i <= n; i++){
cin >> p[i].F >> p[i].S;
}b[1] = p[1].F;
for(int i = 2; i <= n; i++){
if(p[i].F <= b[i - 1]){
if(b[i - 1] <= p[i].S){
b[i] = b[i - 1];
}else{
b[i] = p[i].F;
}
}else{
b[i] = p[i].F;
}
}for(int i = 1; i <= n; i++){
if(b[i - 1] <= b[i]){
cnt++;
}else{
mx = max(cnt, mx);
cnt = 1;
}
}cout << mx;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |