제출 #1099099

#제출 시각아이디문제언어결과실행 시간메모리
1099099baoquan3단 점프 (JOI19_jumps)C++14
0 / 100
2 ms348 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int maxn = 1e6 + 4; int a[maxn] , n , m; void nhap() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); freopen("CHONQUA.INP" , "r" , stdin); freopen("CHONQUA.OUT" , "w" , stdout); cin >> n; for (int i = 1 ; i <= n ; i ++) cin >> a[i]; cin >> m; } void xl1(int l , int r) { int ans = 0; for (int i = l ; i <= r - 2 ; i ++) { for (int j = i + 1 ; j <= r - 1 ; j ++) { for (int k = j + (j - i) ; k <= r ; k ++) { ans = max(ans , a[i] + a[j] + a[k]); } } } cout << ans << '\n'; } void Sub1() { for (int i = 1 ; i <= m ; i ++) { int l , r; cin >> l >> r; xl1(l , r); } } signed main() { nhap(); if (n <= 100 && m <= 100) Sub1(); }

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

jumps.cpp: In function 'void nhap()':
jumps.cpp:15:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     freopen("CHONQUA.INP" , "r" , stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
jumps.cpp:16:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     freopen("CHONQUA.OUT" , "w" , stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...