제출 #197023

#제출 시각아이디문제언어결과실행 시간메모리
197023quocnguyen1012Foehn Phenomena (JOI17_foehn_phenomena)C++14
30 / 100
7 ms1016 KiB
#include <bits/stdc++.h> #define fi first #define se second #define mp make_pair #define pb push_back using namespace std; typedef long long ll; const int maxn = 3e4 + 5; int N, Q, S, T; int a[maxn]; ll res = 0; void add(int pos, int val) { if (pos == N) return; res -= 1ll * a[pos] * (a[pos] < 0 ? S : T); a[pos] += val; res += 1ll * a[pos] * (a[pos] < 0 ? S : T); } signed main(void) { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if (fopen("A.INP", "r")){ freopen("A.INP", "r", stdin); freopen("A.OUT", "w", stdout); } cin >> N >> Q >> S >> T; for (int i = 0; i <= N; ++i){ cin >> a[i]; } for (int i = 0; i < N; ++i){ int x = a[i] - a[i + 1]; a[i] = 0; add(i, x); } while (Q--){ int l, r, val; cin >> l >> r >> val; add(l - 1, -val); add(r, val); cout << res << '\n'; } }

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

foehn_phenomena.cpp: In function 'int main()':
foehn_phenomena.cpp:29:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("A.INP", "r", stdin);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
foehn_phenomena.cpp:30:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("A.OUT", "w", stdout);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...