제출 #105800

#제출 시각아이디문제언어결과실행 시간메모리
105800antimirageTwo Antennas (JOI19_antennas)C++14
2 / 100
3061 ms6504 KiB
#include <bits/stdc++.h>
 
#define fr first
#define sc second
#define mk make_pair
#define pb push_back
#define all(s) s.begin(), s.end()
 
using namespace std;

const int N = 2e5 + 5;

int n, a[N], b[N], c[N], q, l, r;

main() {
	
	cin >> n;
	
	for (int i = 1; i <= n; i++){
		
		cin >> c[i] >> a[i] >> b[i];
	}
	
	cin >> q;
	
	while (q--){
		cin >> l >> r;
		
		int ans = -1;
		
		for (int i = l; i < r; i++){
			for (int j = i + 1; j <= r; j++){
				
				if ( max( a[i], a[j] ) <= j - i && j - i <= min( b[i], b[j]) ){
					ans = max(ans, abs(c[i] - c[j]) );
				}
			}
		}
		cout << ans << endl;
	}
}

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

antennas.cpp:15:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...