제출 #122706

#제출 시각아이디문제언어결과실행 시간메모리
122706win11905Two Antennas (JOI19_antennas)C++11
2 / 100
3055 ms376 KiB
#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] <= j-i && j-i <= y[i]) && (x[j] <= j-i && j-i <= y[j])) mx = max(mx, abs(h[i] - h[j])); 
        }
        printf("%d\n", mx);
    }
}

컴파일 시 표준 에러 (stderr) 메시지

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);
                   ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...