제출 #1103943

#제출 시각아이디문제언어결과실행 시간메모리
1103943normankr07Foehn Phenomena (JOI17_foehn_phenomena)C++17
0 / 100
72 ms10056 KiB
#define taskname "" #include <bits/stdc++.h> using namespace std; using ll = long long; #ifndef LOCAL #define cerr \ if (0) \ cerr #endif const bool multitest = 0; const int MAXN = 2e5 + 69; int N, Q, S, T; int A[MAXN], diff[MAXN]; void solve() { cin >> N >> Q >> S >> T; ll ans = 0; for(int i = 1; i <= N + 1; i++) { cin >> A[i]; diff[i] = A[i] - A[i - 1]; ans += (-diff[i]) * ((diff[i] > 0) ? S : T); } for(int i = 1; i <= Q; i++) { int l, r, v; cin >> l >> r >> v; l++, r++; ans -= (-diff[l]) * ((diff[l] > 0) ? S : T); diff[l] += v; ans += (-diff[l]) * ((diff[l] > 0) ? S : T); if(r != N + 1) { ans -= (-diff[r + 1]) * ((diff[r + 1] > 0) ? S : T); diff[r + 1] -= v; ans += (-diff[r + 1]) * ((diff[r + 1] > 0) ? S : T); } cout << ans << "\n"; } } int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); if(fopen(taskname ".inp", "r")) { freopen(taskname ".inp", "r", stdin); freopen(taskname ".out", "w", stdout); } int tc = 1; if(multitest) cin >> tc; while(tc--) { solve(); cout << '\n'; } }

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

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