제출 #1093355

#제출 시각아이디문제언어결과실행 시간메모리
1093355kemBouquet (EGOI24_bouquet)C++14
44 / 100
45 ms25436 KiB
#include <bits/stdc++.h> using namespace std; #define NAME "name" #define ll long long #define pb push_back #define pii pair<int, int> #define fi first #define se second #define endl "\n" #define sz(v) (int)(v).size() #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() const int LIM = 2e5 + 3; const int INF = 1e9; const int mod = 1e9 + 7; int n, l, r; vector<pii> upd[LIM]; int bit[LIM]; int ans = 1; void update(int idx, int val) { for (; idx < LIM; idx = idx | (idx + 1)) bit[idx] = max(bit[idx], val); } int get(int idx) { int res = 0; for (; idx >= 0; idx = (idx & (idx + 1)) - 1) res = max(res, bit[idx]); return res; } signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); if (ifstream(NAME ".inp")) { freopen(NAME ".inp", "r", stdin); freopen(NAME ".out", "w", stdout); } cin >> n; for (int i = 1; i <= n; i++) { for (auto v : upd[i]) update(v.fi, v.se); cin >> l >> r; int res = get(i - l - 1) + 1; ans = max(ans, res); upd[i + r + 1].pb({i, res}); } cout << ans; return 0; }

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

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