Submission #361719

# Submission time Handle Problem Language Result Execution time Memory
361719 2021-01-31T11:21:03 Z wildturtle Lightning Rod (NOI18_lightningrod) C++14
66 / 100
2000 ms 73884 KB
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,n;
bool l;
stack < pair <int , int > > st;
int main() {
    //ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  scanf ("%d",&n);
    for(int i=1;i<=n;i++) {
        scanf ("%d",&a);
        scanf ("%d",&b);
        l=0;
        while(!st.empty()) {
            c=st.top().first;
            d=st.top().second;
            if(a+b<=c+d) { l=1; break; }
            if(a-b<=c-d) st.pop();
            else break;
        }
        if(l==0) st.push({a,b});
    }
    cout<<st.size();
}

Compilation message

lightningrod.cpp: In function 'int main()':
lightningrod.cpp:8:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    8 |   scanf ("%d",&n);
      |   ~~~~~~^~~~~~~~~
lightningrod.cpp:10:15: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   10 |         scanf ("%d",&a);
      |         ~~~~~~^~~~~~~~~
lightningrod.cpp:11:15: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   11 |         scanf ("%d",&b);
      |         ~~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Execution timed out 2051 ms 73884 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 2 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 2 ms 364 KB Output is correct
14 Correct 54 ms 364 KB Output is correct
15 Correct 53 ms 364 KB Output is correct
16 Correct 49 ms 1004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2068 ms 46856 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2051 ms 73884 KB Time limit exceeded
2 Halted 0 ms 0 KB -