Submission #11245583
Source Code Expand
// // Created by 吴习哲 on 2020/3/27. // #include <cstdio> #include <algorithm> using namespace std; long long N,Q,S,T; long long A[200005]; long long diff[200005]; long long cnt; long long temper(long long x){ if(x>=0){ return -x*S; }else{ return -x*T; } } int main(){ scanf("%lld%lld%lld%lld",&N,&Q,&S,&T); for(int i = 1;i<=N+1;++i){ scanf("%lld",&A[i]); diff[i]=A[i]-A[i-1]; } for(int i = 2;i<=N+1;++i){ cnt+=temper(diff[i]); } for (int i = 1; i <= Q; ++i) { long long l,r,x; scanf("%lld%lld%lld",&l,&r,&x); l+=1; r+=1; if(r!=N+1){ int lastr = diff[r+1]; diff[r+1]-=x; cnt += temper(diff[r+1])-temper(lastr); } int lastl = diff[l]; diff[l]+=x; cnt += temper(diff[l])-temper(lastl); printf("%lld\n",cnt); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - フェーン現象 (Foehn Phenomena) |
User | luogu_bot3 |
Language | C++ (GCC 5.4.1) |
Score | 30 |
Code Size | 926 Byte |
Status | WA |
Exec Time | 107 ms |
Memory | 7296 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:22:42: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%lld%lld%lld%lld",&N,&Q,&S,&T); ^ ./Main.cpp:24:28: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%lld",&A[i]); ^ ./Main.cpp:32:39: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%lld%lld%lld",&l,&r,&x); ^
Judge Result
Set Name | Subtask01 | Subtask02 | Subtask03 | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 30 / 30 | 0 / 10 | 0 / 60 | ||||||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Subtask01 | 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, sample-01.txt, sample-02.txt, sample-03.txt |
Subtask02 | 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, 02-08.txt, 02-09.txt, 02-10.txt, 02-11.txt, 02-12.txt, 02-13.txt, sample-02 |
Subtask03 | 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, 02-08.txt, 02-09.txt, 02-10.txt, 02-11.txt, 02-12.txt, 02-13.txt, 03-01.txt, 03-02.txt, 03-03.txt, 03-04.txt, 03-05.txt, 03-06.txt, 03-07.txt, 03-08.txt, 03-09.txt, 03-10.txt, 03-11.txt, 03-12.txt, 03-13.txt, 03-14.txt, 03-15.txt, 03-16.txt, 03-17.txt, 03-18.txt, sample-01.txt, sample-02.txt, sample-03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 1 ms | 256 KB |
01-02.txt | AC | 1 ms | 256 KB |
01-03.txt | AC | 2 ms | 256 KB |
01-04.txt | AC | 1 ms | 256 KB |
01-05.txt | AC | 1 ms | 256 KB |
01-06.txt | AC | 1 ms | 256 KB |
01-07.txt | AC | 1 ms | 256 KB |
01-08.txt | AC | 1 ms | 256 KB |
01-09.txt | AC | 1 ms | 256 KB |
01-10.txt | AC | 1 ms | 256 KB |
01-11.txt | AC | 1 ms | 256 KB |
01-12.txt | AC | 1 ms | 256 KB |
01-13.txt | AC | 1 ms | 256 KB |
01-14.txt | AC | 1 ms | 256 KB |
01-15.txt | AC | 1 ms | 256 KB |
01-16.txt | AC | 1 ms | 256 KB |
01-17.txt | AC | 1 ms | 256 KB |
01-18.txt | AC | 1 ms | 256 KB |
01-19.txt | AC | 1 ms | 128 KB |
01-20.txt | AC | 1 ms | 128 KB |
01-21.txt | AC | 1 ms | 128 KB |
02-01.txt | AC | 101 ms | 4736 KB |
02-02.txt | AC | 101 ms | 5248 KB |
02-03.txt | AC | 103 ms | 5888 KB |
02-04.txt | AC | 98 ms | 4992 KB |
02-05.txt | AC | 102 ms | 5760 KB |
02-06.txt | AC | 93 ms | 6144 KB |
02-07.txt | AC | 93 ms | 6144 KB |
02-08.txt | AC | 104 ms | 6144 KB |
02-09.txt | AC | 105 ms | 6400 KB |
02-10.txt | AC | 102 ms | 5248 KB |
02-11.txt | AC | 89 ms | 6272 KB |
02-12.txt | WA | 95 ms | 7296 KB |
02-13.txt | WA | 94 ms | 7296 KB |
03-01.txt | AC | 100 ms | 4864 KB |
03-02.txt | AC | 105 ms | 6272 KB |
03-03.txt | AC | 106 ms | 7040 KB |
03-04.txt | AC | 106 ms | 6784 KB |
03-05.txt | AC | 105 ms | 6784 KB |
03-06.txt | AC | 106 ms | 6784 KB |
03-07.txt | AC | 105 ms | 6656 KB |
03-08.txt | AC | 106 ms | 6784 KB |
03-09.txt | AC | 106 ms | 6016 KB |
03-10.txt | AC | 105 ms | 6400 KB |
03-11.txt | AC | 101 ms | 6272 KB |
03-12.txt | AC | 107 ms | 6912 KB |
03-13.txt | AC | 94 ms | 6784 KB |
03-14.txt | AC | 93 ms | 7040 KB |
03-15.txt | AC | 103 ms | 6016 KB |
03-16.txt | WA | 93 ms | 7296 KB |
03-17.txt | WA | 95 ms | 7296 KB |
03-18.txt | WA | 95 ms | 7296 KB |
sample-01.txt | AC | 1 ms | 128 KB |
sample-02.txt | AC | 1 ms | 128 KB |
sample-03.txt | AC | 1 ms | 128 KB |