Submission #111779

# Submission time Handle Problem Language Result Execution time Memory
111779 2019-05-16T07:01:55 Z TexTang Two Antennas (JOI19_antennas) C++14
2 / 100
3000 ms 1572 KB
#include <iostream>

using namespace std;
typedef long long ll;
int main () {
    int n;cin >> n;
    int height[n + 1]; bool con[n + 1][n + 1];
    for(int i = 0;i <= n;i++)
        for(int j = 0;j <= n;j++)
            con[i][j] = false;
    for(int i = 1,u,v;i <= n;i++){
        cin >> height[i] >> u >> v;
        for(int j = i + u;j <= i + v && j <= n;j++){
            con[i][j] = true;
        }
        for(int j = i - u;j >= 0 && j >= i - v;j--){
            con[i][j] = true;
        }
    }
    int q; cin >> q;
    for(int p = 0;p < q;p++){
        int u,v;
        cin >> u >> v;
        int ans = -1;
        for(int i = u;i <= v;i++){
            for(int j = u;j <= v;j++){
                if(con[i][j] && con[j][i]){
              //      cout << i <<  " " << j << " " << height[i] << " " << height[j] << " " << height[i] - height[j] << endl;
                    ans = max(ans, abs(height[i] - height[j]));
                }
            }
        }
        cout << ans << endl;;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 7 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 5 ms 512 KB Output is correct
7 Correct 7 ms 384 KB Output is correct
8 Correct 7 ms 384 KB Output is correct
9 Correct 3 ms 256 KB Output is correct
10 Correct 7 ms 384 KB Output is correct
11 Correct 4 ms 256 KB Output is correct
12 Correct 9 ms 384 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 7 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 7 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 6 ms 384 KB Output is correct
19 Correct 4 ms 384 KB Output is correct
20 Correct 7 ms 384 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 7 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 6 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 7 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 5 ms 512 KB Output is correct
7 Correct 7 ms 384 KB Output is correct
8 Correct 7 ms 384 KB Output is correct
9 Correct 3 ms 256 KB Output is correct
10 Correct 7 ms 384 KB Output is correct
11 Correct 4 ms 256 KB Output is correct
12 Correct 9 ms 384 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 7 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 7 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 6 ms 384 KB Output is correct
19 Correct 4 ms 384 KB Output is correct
20 Correct 7 ms 384 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 7 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 6 ms 384 KB Output is correct
25 Execution timed out 3093 ms 1572 KB Time limit exceeded
26 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 7 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 5 ms 512 KB Output is correct
7 Correct 7 ms 384 KB Output is correct
8 Correct 7 ms 384 KB Output is correct
9 Correct 3 ms 256 KB Output is correct
10 Correct 7 ms 384 KB Output is correct
11 Correct 4 ms 256 KB Output is correct
12 Correct 9 ms 384 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 7 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 7 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 6 ms 384 KB Output is correct
19 Correct 4 ms 384 KB Output is correct
20 Correct 7 ms 384 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 7 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 6 ms 384 KB Output is correct
25 Execution timed out 3093 ms 1572 KB Time limit exceeded
26 Halted 0 ms 0 KB -