제출 #1306957

#제출 시각아이디문제언어결과실행 시간메모리
1306957ballbreakerFoehn Phenomena (JOI17_foehn_phenomena)C++20
30 / 100
1094 ms1996 KiB
#include <bits/stdc++.h> #define int long long using namespace std; main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, q, s, t; cin >> n >> q >> s >> t; int a[n + 1]; for (int i = 0; i <= n; i++) { cin >> a[i]; } while (q--) { int l, r, x; cin >> l >> r >> x; for (int j = l; j <= r; j++) { a[j] += x; } int ans = 0; for (int i = 1; i <= n; i++) { if (a[i - 1] < a[i]) { ans -= s * (a[i] - a[i - 1]); } else { ans += t * (a[i - 1] - a[i]); } // cout << ans << ' '; } cout << ans << endl; } }

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

foehn_phenomena.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main() {
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...