Submission #197939

# Submission time Handle Problem Language Result Execution time Memory
197939 2020-01-24T11:38:41 Z popovicirobert Lightning Rod (NOI18_lightningrod) C++14
0 / 100
2000 ms 203908 KB
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define lsb(x) (x & (-x))
#define uint unsigned int


    
using namespace std;

const int MAXN = (int) 1e7;

int x[MAXN + 1], y[MAXN + 1];
int stk[MAXN + 1];
  
int main() {
#ifdef HOME
    ifstream cin("A.in");
    //ofstream cout("A.out");
#endif
	int i, n;
    ios::sync_with_stdio(false);
   	cin.tie(0), cout.tie(0);
	
	cin >> n;
	
	for(i = 1; i <= n; i++) {
		cin >> x[i] >> y[i];
	}	
	
	int sz = 0;
	for(i = 1; i <= n; i++) {
		while(sz > 0 && x[i] - x[stk[sz]] <= y[i] - y[stk[sz]]) {
			sz--;
		}
		stk[++sz] = i;
	}
	
	cout << sz;
	
	return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 2021 ms 186444 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2025 ms 203908 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2021 ms 186444 KB Time limit exceeded
2 Halted 0 ms 0 KB -