제출 #813557

#제출 시각아이디문제언어결과실행 시간메모리
813557manhlinh1501Art Exhibition (JOI18_art)C++17
0 / 100
2 ms340 KiB
/// @author : Hoang Manh Linh #include <bits/stdc++.h> using namespace std; const int MAXN = 5e5 + 5; using i64 = long long; using pll = pair<i64, i64>; int n; pll a[MAXN]; i64 sum[MAXN]; i64 ans = 0; int main(int argc, char **argv) { if(fopen(".inp", "r")) { freopen(".inp", "r", stdin); freopen(".out", "w", stdout); } #ifndef ONLINE_JUDGE freopen("test.inp", "r", stdin); #endif // ONLINE_JUDGE ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for(int i = 1; i <= n; i++) cin >> a[i].first >> a[i].second; sort(a + 1, a + n + 1); for(int i = 1; i <= n; i++) sum[i] = sum[i - 1] + a[i].second; for(int i = 1; i <= n; i++) { for(int j = i; j <= n; j++) ans = max(ans, (sum[j] - sum[i - 1]) - (a[j].first - a[i].first)); } cout << ans; }

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

art.cpp: In function 'int main(int, char**)':
art.cpp:16:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         freopen(".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~
art.cpp:17:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |         freopen(".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
art.cpp:21:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |     freopen("test.inp", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...