Submission #201865

# Submission time Handle Problem Language Result Execution time Memory
201865 2020-02-12T11:04:01 Z theStaticMind Two Antennas (JOI19_antennas) C++14
2 / 100
3000 ms 524292 KB
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define INF 100000000000000000
#define modulo 1000000007
#define mod 998244353
#define int long long int
using namespace std;

int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
   //   freopen("q.gir","r",stdin);
   //   freopen("q.cik","w",stdout);
      int n;
      cin >> n;
      vector<int> H(n + 1);
      vector<int> A(n + 1);
      vector<int> B(n+ 1);
      for(int i = 1; i <= n; i++){
            cin >> H[i] >> A[i] >> B[i];
      }

      int q;
      cin >> q;
      while(q--){
            int l, r, ans = -1;
            cin >> l >> r;
            set<int> S[n + 1];
            for(int i = l; i <= r; i++){
                  for(int j = max(1ll, i - B[i]); j <= max(0ll, i - A[i]); j++){
                        if(S[j].count(i)) ans = max(ans, abs(H[i] - H[j]));
                        S[i].insert(j);
                  }
                  for(int j = min(n + 1, i + A[i]); j <= min(n, i + B[i]); j++){
                        if(S[j].count(i)) ans = max(ans, abs(H[i] - H[j]));
                        S[i].insert(j);
                  }
            }
            cout << ans << "\n";
      }
}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 504 KB Output is correct
2 Correct 90 ms 1272 KB Output is correct
3 Correct 78 ms 1016 KB Output is correct
4 Correct 140 ms 1272 KB Output is correct
5 Correct 31 ms 760 KB Output is correct
6 Correct 76 ms 1272 KB Output is correct
7 Correct 113 ms 1144 KB Output is correct
8 Correct 140 ms 1272 KB Output is correct
9 Correct 23 ms 504 KB Output is correct
10 Correct 116 ms 1400 KB Output is correct
11 Correct 9 ms 376 KB Output is correct
12 Correct 137 ms 1400 KB Output is correct
13 Correct 44 ms 760 KB Output is correct
14 Correct 40 ms 632 KB Output is correct
15 Correct 58 ms 892 KB Output is correct
16 Correct 29 ms 504 KB Output is correct
17 Correct 53 ms 888 KB Output is correct
18 Correct 62 ms 760 KB Output is correct
19 Correct 7 ms 632 KB Output is correct
20 Correct 45 ms 632 KB Output is correct
21 Correct 44 ms 632 KB Output is correct
22 Correct 63 ms 760 KB Output is correct
23 Correct 60 ms 764 KB Output is correct
24 Correct 49 ms 760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 504 KB Output is correct
2 Correct 90 ms 1272 KB Output is correct
3 Correct 78 ms 1016 KB Output is correct
4 Correct 140 ms 1272 KB Output is correct
5 Correct 31 ms 760 KB Output is correct
6 Correct 76 ms 1272 KB Output is correct
7 Correct 113 ms 1144 KB Output is correct
8 Correct 140 ms 1272 KB Output is correct
9 Correct 23 ms 504 KB Output is correct
10 Correct 116 ms 1400 KB Output is correct
11 Correct 9 ms 376 KB Output is correct
12 Correct 137 ms 1400 KB Output is correct
13 Correct 44 ms 760 KB Output is correct
14 Correct 40 ms 632 KB Output is correct
15 Correct 58 ms 892 KB Output is correct
16 Correct 29 ms 504 KB Output is correct
17 Correct 53 ms 888 KB Output is correct
18 Correct 62 ms 760 KB Output is correct
19 Correct 7 ms 632 KB Output is correct
20 Correct 45 ms 632 KB Output is correct
21 Correct 44 ms 632 KB Output is correct
22 Correct 63 ms 760 KB Output is correct
23 Correct 60 ms 764 KB Output is correct
24 Correct 49 ms 760 KB Output is correct
25 Execution timed out 3059 ms 8444 KB Time limit exceeded
26 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2077 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 504 KB Output is correct
2 Correct 90 ms 1272 KB Output is correct
3 Correct 78 ms 1016 KB Output is correct
4 Correct 140 ms 1272 KB Output is correct
5 Correct 31 ms 760 KB Output is correct
6 Correct 76 ms 1272 KB Output is correct
7 Correct 113 ms 1144 KB Output is correct
8 Correct 140 ms 1272 KB Output is correct
9 Correct 23 ms 504 KB Output is correct
10 Correct 116 ms 1400 KB Output is correct
11 Correct 9 ms 376 KB Output is correct
12 Correct 137 ms 1400 KB Output is correct
13 Correct 44 ms 760 KB Output is correct
14 Correct 40 ms 632 KB Output is correct
15 Correct 58 ms 892 KB Output is correct
16 Correct 29 ms 504 KB Output is correct
17 Correct 53 ms 888 KB Output is correct
18 Correct 62 ms 760 KB Output is correct
19 Correct 7 ms 632 KB Output is correct
20 Correct 45 ms 632 KB Output is correct
21 Correct 44 ms 632 KB Output is correct
22 Correct 63 ms 760 KB Output is correct
23 Correct 60 ms 764 KB Output is correct
24 Correct 49 ms 760 KB Output is correct
25 Execution timed out 3059 ms 8444 KB Time limit exceeded
26 Halted 0 ms 0 KB -