제출 #519994

#제출 시각아이디문제언어결과실행 시간메모리
519994vinnipuh01Foehn Phenomena (JOI17_foehn_phenomena)C++17
30 / 100
1092 ms1972 KiB
#include <iostream>
#include <bits/stdc++.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>
#include <stack>
#include <string>
#include <map>
#include <queue>
#define int long long

using namespace std;

const long long oo = 1000000000000000000;

long long sum, ans = 0, mx = 0, mn = 1000000000, num, pos;


/*
    ViHHiPuh

   (( `'-""``""-'` ))
     )-__-_.._-__-(
   / --- (o _ o) --- \
   \ .-* ( .0. ) *-. /
   _'-. ,_ '=' _, .-'_
  / `;#'#'# - #'#'#;` \
 \_)) -----'#'----- ((_/
      # --------- #
  '# ------- ------ #'
  /..-'# ------- #'-.\
  _\...-\'# -- #'/-.../_
  ((____)- '#' -(____))


    cout << fixed << setprecision(6) << x;

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    freopen ( "sum.in", "r", stdin )
*/


main () {
	int n;
	cin >> n;
	int m;
	cin >> m;
	int s;
	cin >> s;
	int t;
	cin >> t;
	int a[ n + 1 ];
	for ( int i = 0; i <= n; i ++ ) {
		cin >> a[ i ];
	}
	int l, r, x;
	while ( m -- ) {
		cin >> l >> r >> x;
		for ( int i = l; i <= r; i ++ )
			a[ i ] += x;
		for ( int i = 1; i <= n; i ++ ) {
			if ( a[ i ] > a[ i - 1 ] )
				ans -= s * ( a[ i ] - a[ i - 1 ] );
			else
				ans += t * ( a[ i - 1 ] - a[ i ] );
		}
		cout << ans << "\n";
		ans = 0;
	}
}

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

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