답안 #599885

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
599885 2022-07-20T05:51:06 Z starchan Lightning Rod (NOI18_lightningrod) C++17
80 / 100
660 ms 262148 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);
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 Correct 317 ms 156872 KB Output is correct
2 Correct 418 ms 262144 KB Output is correct
3 Correct 379 ms 262144 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 71 ms 156840 KB Output is correct
2 Correct 58 ms 156868 KB Output is correct
3 Correct 59 ms 156852 KB Output is correct
4 Correct 75 ms 156768 KB Output is correct
5 Correct 57 ms 156860 KB Output is correct
6 Correct 60 ms 156880 KB Output is correct
7 Correct 57 ms 156832 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 71 ms 156840 KB Output is correct
2 Correct 58 ms 156868 KB Output is correct
3 Correct 59 ms 156852 KB Output is correct
4 Correct 75 ms 156768 KB Output is correct
5 Correct 57 ms 156860 KB Output is correct
6 Correct 60 ms 156880 KB Output is correct
7 Correct 57 ms 156832 KB Output is correct
8 Correct 60 ms 156876 KB Output is correct
9 Correct 66 ms 156768 KB Output is correct
10 Correct 60 ms 156760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 71 ms 156840 KB Output is correct
2 Correct 58 ms 156868 KB Output is correct
3 Correct 59 ms 156852 KB Output is correct
4 Correct 75 ms 156768 KB Output is correct
5 Correct 57 ms 156860 KB Output is correct
6 Correct 60 ms 156880 KB Output is correct
7 Correct 57 ms 156832 KB Output is correct
8 Correct 60 ms 156876 KB Output is correct
9 Correct 66 ms 156768 KB Output is correct
10 Correct 60 ms 156760 KB Output is correct
11 Correct 58 ms 156848 KB Output is correct
12 Correct 61 ms 156868 KB Output is correct
13 Correct 60 ms 156904 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 71 ms 156840 KB Output is correct
2 Correct 58 ms 156868 KB Output is correct
3 Correct 59 ms 156852 KB Output is correct
4 Correct 75 ms 156768 KB Output is correct
5 Correct 57 ms 156860 KB Output is correct
6 Correct 60 ms 156880 KB Output is correct
7 Correct 57 ms 156832 KB Output is correct
8 Correct 60 ms 156876 KB Output is correct
9 Correct 66 ms 156768 KB Output is correct
10 Correct 60 ms 156760 KB Output is correct
11 Correct 58 ms 156848 KB Output is correct
12 Correct 61 ms 156868 KB Output is correct
13 Correct 60 ms 156904 KB Output is correct
14 Correct 71 ms 160364 KB Output is correct
15 Correct 67 ms 160224 KB Output is correct
16 Correct 67 ms 159580 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 375 ms 156876 KB Output is correct
2 Correct 382 ms 253276 KB Output is correct
3 Correct 378 ms 250848 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 317 ms 156872 KB Output is correct
2 Correct 418 ms 262144 KB Output is correct
3 Correct 379 ms 262144 KB Output is correct
4 Correct 71 ms 156840 KB Output is correct
5 Correct 58 ms 156868 KB Output is correct
6 Correct 59 ms 156852 KB Output is correct
7 Correct 75 ms 156768 KB Output is correct
8 Correct 57 ms 156860 KB Output is correct
9 Correct 60 ms 156880 KB Output is correct
10 Correct 57 ms 156832 KB Output is correct
11 Correct 60 ms 156876 KB Output is correct
12 Correct 66 ms 156768 KB Output is correct
13 Correct 60 ms 156760 KB Output is correct
14 Correct 58 ms 156848 KB Output is correct
15 Correct 61 ms 156868 KB Output is correct
16 Correct 60 ms 156904 KB Output is correct
17 Correct 71 ms 160364 KB Output is correct
18 Correct 67 ms 160224 KB Output is correct
19 Correct 67 ms 159580 KB Output is correct
20 Correct 375 ms 156876 KB Output is correct
21 Correct 382 ms 253276 KB Output is correct
22 Correct 378 ms 250848 KB Output is correct
23 Runtime error 660 ms 262148 KB Memory limit exceeded
24 Halted 0 ms 0 KB -