Submission #865364

# Submission time Handle Problem Language Result Execution time Memory
865364 2023-10-24T07:42:14 Z Trisanu_Das Lightning Rod (NOI18_lightningrod) C++17
66 / 100
2000 ms 50412 KB
#include <bits/stdc++.h>
using namespace std;

int dp[10000010], n, mx;
stack<int> s;
 
int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) { 
		int x, y; cin >> x >> y;
		if (i == 1) {
			mx = x + y;
			s.push(x - y);
		}else if (mx < x + y) {
			while (!s.empty() && s.top() >= x - y) s.pop();
			s.push(x - y);
			mx = x + y;
		}
	}
	cout << s.size() << '\n';
}
# Verdict Execution time Memory Grader output
1 Execution timed out 2020 ms 50412 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 440 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 440 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 600 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 440 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 600 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 476 KB Output is correct
13 Correct 1 ms 480 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 440 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 600 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 476 KB Output is correct
13 Correct 1 ms 480 KB Output is correct
14 Correct 100 ms 2308 KB Output is correct
15 Correct 100 ms 2420 KB Output is correct
16 Correct 82 ms 2216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2035 ms 39212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2020 ms 50412 KB Time limit exceeded
2 Halted 0 ms 0 KB -