제출 #155177

#제출 시각아이디문제언어결과실행 시간메모리
155177mat_vFoehn Phenomena (JOI17_foehn_phenomena)C++14
100 / 100
711 ms13284 KiB
#include <bits/stdc++.h> #pragma comment(linker, "/stack:200000000") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define mod 1000000007 #define pb push_back #define mid(l, r) ((l)+(r))/2 #define len(a) (a).length() #define sz(a) (a).size() #define xx first #define yy second #define inf int(2e9) #define ff(i, a, b) for(int (i) = (a); (i) <= (b); ++(i)) #define fb(i, a, b) for(int (i) = (a); (i) >= (b); --(i)) #define maxn 200005 using namespace std; typedef long long ll; typedef pair<int,int> pii; template<class T> void print(const T niz[], const int siz) { for(int i=0;i<siz;i++) cout << niz[i] << " "; cout << endl; } int n,q; ll s,t; ll niz[maxn]; ll dif[maxn]; ll res; int main() { ios_base::sync_with_stdio(false); cin >> n >> q >> s >> t; ff(i,0,n)cin >> niz[i]; ff(i,0,n-1){ dif[i] = niz[i + 1] - niz[i]; if(dif[i] > 0)res -= dif[i]*s; else res -= dif[i]*t; } while(q--){ int l,r; ll x; cin >> l >> r >> x; if(dif[l-1] > 0)res += dif[l-1]*s; else res += dif[l-1]*t; dif[l-1] += x; if(dif[l-1] > 0)res -= dif[l-1]*s; else res -= dif[l-1]*t; if(r != n){ if(dif[r] > 0)res += dif[r]*s; else res += dif[r]*t; dif[r] -= x; if(dif[r] > 0)res -= dif[r]*s; else res -= dif[r]*t; } cout << res << endl; } return 0; }

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

foehn_phenomena.cpp:2:0: warning: ignoring #pragma comment  [-Wunknown-pragmas]
 #pragma comment(linker, "/stack:200000000")
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...