답안 #599869

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
599869 2022-07-20T04:34:13 Z starchan Lightning Rod (NOI18_lightningrod) C++17
0 / 100
402 ms 262144 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define in pair<int, int>
#define f first
#define s second
#define pb push_back
#define pob pop_back
#define INF (int)1e17
#define MX (int)3e5+5
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL)
inline int readInt()
{
	int x = 0; char ch=getchar_unlocked(); bool st = 1;
	while(ch < '0'  || ch > '9'){if(ch=='-')st=0; ch=getchar_unlocked();}
	while(ch>='0'&&ch<='9'){x = (x<<3)+(x<<1)+ch-'0';ch=getchar_unlocked();}
	return st?x:-x;
}
vector<int> add(1e7+1, 0);
vector<int> sub(1e7+1, 0);
vector<bool> tk(1e7+1, 1);
signed main()
{
	fast();
	int n = readInt();
	for(int i = 1; i <= n; i++)
	{
		int x, y;
		x = readInt();
		y = readInt();
		add[i] = x+y;
		sub[i] = y-x;
	}
	for(int i = 2; i <= n; i++)
		add[i] = max(add[i], add[i-1]);
	for(int i = n-1; i >= 1; i--)
		sub[i] = max(sub[i], sub[i+1]);
	int ans = 0;
	for(int i = 1; i <= n; i++)
		ans+=(((i==1)||(add[i] > add[i+1]))&&((i==n)||(sub[i] > sub[i+1])));
	cout << ans;
	return 0;
}	
# 결과 실행 시간 메모리 Grader output
1 Incorrect 394 ms 262144 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 55 ms 158028 KB Output is correct
2 Correct 59 ms 158004 KB Output is correct
3 Incorrect 61 ms 158104 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 55 ms 158028 KB Output is correct
2 Correct 59 ms 158004 KB Output is correct
3 Incorrect 61 ms 158104 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 55 ms 158028 KB Output is correct
2 Correct 59 ms 158004 KB Output is correct
3 Incorrect 61 ms 158104 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 55 ms 158028 KB Output is correct
2 Correct 59 ms 158004 KB Output is correct
3 Incorrect 61 ms 158104 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 402 ms 254596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 394 ms 262144 KB Output isn't correct
2 Halted 0 ms 0 KB -