Submission #268951

# Submission time Handle Problem Language Result Execution time Memory
268951 2020-08-17T04:27:24 Z wutwere Lightning Rod (NOI18_lightningrod) C++17
4 / 100
1743 ms 82412 KB
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define _F(i,a,b,s) for(int i=(a);((s)>0?i<(b):i>(b));i+=(s))
#define _1(e) _F(i,0,e,1)
#define _2(i,e) _F(i,0,e,1)
#define _3(i,b,e) _F(i,b,e,(b)<(e)?1:-1)
#define _G(a,b,c,d,e,...) e
#define FOR(...) _G(__VA_ARGS__,_F,_3,_2,_1)(__VA_ARGS__)

int main() {
	ios::sync_with_stdio(0),cin.tie(0);
	int n; cin >> n;
	stack<pair<int, int>> ans;
	FOR (n) {
		int x, y; cin >> x >> y;
		pair<int, int> top = {-1e9, -1e9};
		while (!ans.empty() && abs(x - top.first) <= y - top.second) {
			ans.pop();
			top = ans.top();
		}
		if (ans.empty() || abs(top.first - x) > top.second - y) ans.push({x, y});
	}
	cout << ans.size() << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1720 ms 80412 KB Output is correct
2 Correct 1714 ms 79816 KB Output is correct
3 Correct 1675 ms 77728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1743 ms 82412 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1720 ms 80412 KB Output is correct
2 Correct 1714 ms 79816 KB Output is correct
3 Correct 1675 ms 77728 KB Output is correct
4 Runtime error 1 ms 512 KB Execution killed with signal 11
5 Halted 0 ms 0 KB -