제출 #1108394

#제출 시각아이디문제언어결과실행 시간메모리
1108394vjudge1Art Exhibition (JOI18_art)C++17
50 / 100
1075 ms11988 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define FOR(i, a, b) for(int i = (a); i <= (b); i++) #define FORD(i, b, a) for(int i = (b); i >= (a); i--) #define pa pair<ll, ll> #define fi first #define se second #define bit(mask, j) (mask & (1<<j)) const ll mod = 1e9 + 7; const ll INF = 1e17; const ll N = 5e5 + 10; pa a[N]; ll s[N], ans = 0; int main() { ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); #define NAME "hbmt" if(fopen(NAME".inp", "r")) { freopen(NAME".inp", "r", stdin); freopen(NAME".out", "w", stdout); } ll n; cin >> n; FOR(i, 1, n) { cin >> a[i].fi >> a[i].se; } sort(a + 1, a + n + 1); FOR(i, 1, n) { s[i] = s[i - 1] + a[i].se; } FOR(i, 1, n) { ll res = 0; FORD(j, i, 1) { res += a[j].se; ans = max(ans, res - (a[i].fi - a[j].fi)); } } // FOR(i, 1, n) // { // ll res = s[i] - a[i].fi + a[1].fi; // ll res2 = s[n] - s[i - 1] - a[n].fi + a[i].fi; // ans = max({ans, res, res2}); // } cout << ans; return 0; }

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

art.cpp: In function 'int main()':
art.cpp:21:20: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |             freopen(NAME".inp", "r", stdin);
      |             ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
art.cpp:22:20: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |             freopen(NAME".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...