Submission #131960

#TimeUsernameProblemLanguageResultExecution timeMemory
131960ekremTwo Antennas (JOI19_antennas)C++98
2 / 100
3043 ms4600 KiB
#include <bits/stdc++.h> #define st first #define nd second #define mp make_pair #define pb push_back #define sol (k+k) #define sag (k+k+1) #define orta ((bas+son)/2) #define coc g[node][i] #define mod 1000000007 #define inf 1000000009 #define N 1000005 using namespace std; typedef long long ll; typedef pair < ll , ll > ii; ll n, q, k, h[N], a[N], b[N], seg[2][4*N]; pair < ll , ii > x[N]; set < ll > s; int main() { // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); scanf("%lld",&n); for(ll i = 1; i <= n; i++) scanf("%lld %lld %lld", h + i, a + i, b + i); scanf("%lld",&q); while(q--){ ll ans = -1; ll bas, son; scanf("%lld %lld",&bas, &son); k = 0; for(int i = bas; i <= son; i++) for(int j = i + 1; j <= son; j++){ if(j - i <= min(b[i], b[j]) and j - i >= max(a[i], a[j])){ ans = max(ans, abs(h[i] - h[j])); } } printf("%lld\n", ans); } return 0; }

Compilation message (stderr)

antennas.cpp: In function 'int main()':
antennas.cpp:25:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&n);
  ~~~~~^~~~~~~~~~~
antennas.cpp:27:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld %lld %lld", h + i, a + i, b + i);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
antennas.cpp:28:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&q);
  ~~~~~^~~~~~~~~~~
antennas.cpp:32:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld %lld",&bas, &son);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...