제출 #1125946

#제출 시각아이디문제언어결과실행 시간메모리
1125946lam280407Jobs (BOI24_jobs)C++20
0 / 100
49 ms4928 KiB
#include<bits/stdc++.h> #define int long long #define vi vector<int> #define vl vector<ll> #define pii pair<int, int> #define pll pair<ll, ll> #define fi first #define se second #define pb push_back #define all(x) (x).begin(),(x).end() #define inf32 0x3f3f3f3f #define inf64 0x3f3f3f3f3f3f3f3f #define el '\n' #define bit(n, i) ((n >> i) & 1) #define TASK "Jobs" using namespace std; const int base = 523; const int blz = 350; const int mode = 998244353; const int N = 3e5 + 3; template<typename T> void maximize(T &a, T b){ if (a < b) a = b; } template<typename T> void minimize(T &a, T b){ if (a > b) a = b; } int n, s; struct query{ int cost, p; bool operator < (const query &other) const{ return p < other.p; } }Q[N]; namespace sub23{ int mx = 0, pre[N]; void init(){ for (int i = 1; i <= n; ++i){ pre[i] = pre[i - 1] + Q[i].cost; if (!Q[i].p) maximize(mx, Q[i].cost); } for (int i = 1; i <= n; ++i){ int cur = s + pre[i]; if (cur < 0) break; maximize(mx, cur - s); } cout << mx; } } void solve(){ cin >> n >> s; bool ok = true; for (int i = 1; i <= n; ++i){ int x, p; cin >> x >> p; Q[i] = {x, p}; if (p != i - 1 && p != 0) ok = false; } if (ok) sub23::init(); else cout << 6; } void file(){ if(fopen(TASK ".inp","r")){ freopen(TASK ".inp","r",stdin); freopen(TASK ".out","w",stdout); } } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); file(); solve(); return 0; }

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

Main.cpp: In function 'void file()':
Main.cpp:72:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   72 |         freopen(TASK ".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:73:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   73 |         freopen(TASK ".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...
#Verdict Execution timeMemoryGrader output
Fetching results...