제출 #1281559

#제출 시각아이디문제언어결과실행 시간메모리
1281559KickingKunJust Long Neckties (JOI20_ho_t1)C++20
100 / 100
64 ms7116 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define ld long double #define bigint __int128 #define emb emplace_back #define pb push_back #define pii pair <int, int> #define fi first #define se second #define all(v) v.begin(), v.end() #define Task "" #define MASK(k) (1ull << k) #define bitcnt(k) __builtin_popcount(k) #define testBit(n, k) ((n >> k) & 1) #define flipBit(n, k) (n ^ (1ll << k)) #define offBit(n, k) (n & ~MASK(k)) #define onBit(n, k) (n | (1ll << k)) template <class T> bool minimize(T &a, T b) {if (a > b) {a = b; return true;} return false;} template <class T> bool maximize(T &a, T b) {if (a < b) {a = b; return true;} return false;} const int N = 2e5 + 5, lim = 60, mod = 1e9 + 7; const ll INF = 1e18; int n, b[N], maL[N], maR[N]; pii a[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); if (fopen(Task".inp", "r")) { freopen(Task".inp", "r", stdin); freopen(Task".out", "w", stdout); } cin >> n; for (int i = 1; i <= n + 1; i++) cin >> a[a[i].se = i].fi; for (int i = 1; i <= n; i++) cin >> b[i]; sort (a + 1, a + n + 2); sort (b + 1, b + n + 1); for (int i = 1; i <= n; i++) maL[i] = max(maL[i - 1], a[i].fi - b[i]); for (int i = n + 1; i > 1; i--) maR[i] = max(maR[i + 1], a[i].fi - b[i - 1]); vector <int> ans(n + 2); for (int i = 1; i <= n + 1; i++) ans[a[i].se] = max(maL[i - 1], maR[i + 1]); for (int i = 1; i <= n + 1; i++) cout << ans[i] << ' '; }

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

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