답안 #122675

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
122675 2019-06-29T06:34:42 Z win11905 Two Antennas (JOI19_antennas) C++11
0 / 100
4 ms 632 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 305;

int n, m;
int h[N], x[N], y[N];

int main() {
    scanf("%d", &n);
    for(int i = 1; i <= n; ++i) 
        scanf("%d %d %d", h+i, x+i, y+i);
    scanf("%d", &m);
    while(m--) {
        int l, r; scanf("%d %d", &l, &r);
        int mx = -1;
        for(int i = l; i <= r; ++i) {
            for(int j = i+1; j <= r; ++j) if((x[i] <= x[j] && x[j] <= y[i]) || (x[j] <= x[i] && x[i] <= y[j])) mx = max(mx, abs(h[i] - h[j])); 
        }
        printf("%d\n", mx);
    }
}

Compilation message

antennas.cpp: In function 'int main()':
antennas.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
antennas.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d %d", h+i, x+i, y+i);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
antennas.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &m);
     ~~~~~^~~~~~~~~~
antennas.cpp:15:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         int l, r; scanf("%d %d", &l, &r);
                   ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4 ms 632 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -