# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
712099 | 2023-03-18T06:29:19 Z | Pherokung | Lightning Rod (NOI18_lightningrod) | C++14 | 1674 ms | 158008 KB |
#include<bits/stdc++.h> using namespace std; #define MAXN 10000005 #define F first #define S second int n,a,b,x[MAXN],y[MAXN],rod[MAXN],ans=0; deque<int> dq; int main(){ scanf("%d",&n); ans = n; for(int i=1;i<=n;i++){ scanf("%d%d",&a,&b); rod[i] = 1; x[i] = b-a; y[i] = b=a; } for(int i=1;i<=n;i++){ while(!dq.empty()){ int p = dq.front(); if(x[i] >= x[p]){ if(rod[p] == 1){ rod[p] = 0; ans--; } dq.pop_front(); } else break; } dq.push_front(i); } while(!dq.empty()) dq.pop_front(); for(int i=n;i>=1;i--){ while(!dq.empty()){ int p = dq.front(); if(y[i] >= y[p]){ if(rod[p] == 1){ rod[p] = 0; ans--; } dq.pop_front(); } else break; } dq.push_front(i); } printf("%d",ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1501 ms | 153852 KB | Output is correct |
2 | Correct | 1564 ms | 153476 KB | Output is correct |
3 | Correct | 1581 ms | 149260 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 216 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Incorrect | 0 ms | 212 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 216 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Incorrect | 0 ms | 212 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 216 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Incorrect | 0 ms | 212 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 216 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Incorrect | 0 ms | 212 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1674 ms | 158008 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1501 ms | 153852 KB | Output is correct |
2 | Correct | 1564 ms | 153476 KB | Output is correct |
3 | Correct | 1581 ms | 149260 KB | Output is correct |
4 | Correct | 0 ms | 216 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Incorrect | 0 ms | 212 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |