Submission #865352

# Submission time Handle Problem Language Result Execution time Memory
865352 2023-10-24T07:39:46 Z Trisanu_Das Lightning Rod (NOI18_lightningrod) C++17
0 / 100
2000 ms 28804 KB
#include <bits/stdc++.h>
using namespace std;
 
int dp[10000005], n, mx;
stack<int> s;
 
int main(){
  cin >> n;
  for(int i = 0; i < n; i++){
    int x, y; cin >> x >> y;
    if(i == 0){
      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 2024 ms 28804 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2032 ms 24408 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2024 ms 28804 KB Time limit exceeded
2 Halted 0 ms 0 KB -