Submission #11315817
Source Code Expand
#include <iostream> #include <cstdio> using namespace std; int n, q, s, t, altitude[200005], diff[200005], temperature; int main() { scanf("%d%d%d%d", &n, &q, &s, &t); for (int i = 0; i <= n; ++i) { scanf("%d", &altitude[i]); if (i > 0)diff[i] = altitude[i] - altitude[i - 1]; } for (int i = 1; i <= n; ++i) { if (diff[i] > 0) { temperature -= diff[i] * s; } else if (diff[i] < 0) { temperature -= diff[i] * t; } } for (int j = 0; j < q; ++j) { int l, r, x; scanf("%d%d%d", &l, &r, &x); if (diff[l] > 0) { temperature += diff[l] * s; } else if (diff[l] < 0) { temperature += diff[l] * t; } diff[l] += x; if (diff[l] > 0) { temperature -= diff[l] * s; } else if (diff[l] < 0) { temperature -= diff[l] * t; } if(r!=n) { if (diff[r+1] > 0) { temperature += diff[r+1] * s; } else if (diff[r+1] < 0) { temperature += diff[r+1] * t; } diff[r + 1] -= x; if (diff[r + 1] > 0) { temperature -= diff[r + 1] * s; } else if (diff[r + 1] < 0) { temperature -= diff[r + 1] * t; } } printf("%d\n",temperature); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - フェーン現象 (Foehn Phenomena) |
User | luogu_bot5 |
Language | C++ (GCC 5.4.1) |
Score | 0 |
Code Size | 1401 Byte |
Status | WA |
Exec Time | 105 ms |
Memory | 4096 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:9:38: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%d%d%d", &n, &q, &s, &t); ^ ./Main.cpp:11:34: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &altitude[i]); ^ ./Main.cpp:23:36: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%d%d", &l, &r, &x); ^
Judge Result
Set Name | Subtask01 | Subtask02 | Subtask03 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 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 | 2 ms | 256 KB |
01-02.txt | WA | 2 ms | 256 KB |
01-03.txt | WA | 2 ms | 256 KB |
01-04.txt | WA | 2 ms | 256 KB |
01-05.txt | WA | 2 ms | 256 KB |
01-06.txt | WA | 2 ms | 256 KB |
01-07.txt | WA | 2 ms | 256 KB |
01-08.txt | WA | 2 ms | 256 KB |
01-09.txt | WA | 2 ms | 256 KB |
01-10.txt | WA | 2 ms | 256 KB |
01-11.txt | WA | 2 ms | 256 KB |
01-12.txt | WA | 2 ms | 256 KB |
01-13.txt | WA | 2 ms | 256 KB |
01-14.txt | WA | 2 ms | 256 KB |
01-15.txt | WA | 2 ms | 256 KB |
01-16.txt | WA | 2 ms | 256 KB |
01-17.txt | WA | 2 ms | 256 KB |
01-18.txt | WA | 2 ms | 256 KB |
01-19.txt | AC | 1 ms | 256 KB |
01-20.txt | AC | 1 ms | 256 KB |
01-21.txt | AC | 1 ms | 256 KB |
02-01.txt | AC | 100 ms | 3200 KB |
02-02.txt | AC | 101 ms | 3840 KB |
02-03.txt | WA | 102 ms | 3840 KB |
02-04.txt | AC | 98 ms | 3584 KB |
02-05.txt | WA | 101 ms | 4096 KB |
02-06.txt | WA | 93 ms | 3968 KB |
02-07.txt | WA | 93 ms | 3968 KB |
02-08.txt | WA | 105 ms | 3968 KB |
02-09.txt | WA | 105 ms | 3968 KB |
02-10.txt | AC | 101 ms | 3712 KB |
02-11.txt | WA | 87 ms | 3712 KB |
02-12.txt | WA | 91 ms | 3968 KB |
02-13.txt | WA | 91 ms | 3968 KB |
03-01.txt | AC | 100 ms | 3328 KB |
03-02.txt | WA | 104 ms | 3968 KB |
03-03.txt | WA | 105 ms | 3968 KB |
03-04.txt | WA | 105 ms | 3968 KB |
03-05.txt | WA | 104 ms | 3968 KB |
03-06.txt | WA | 104 ms | 3968 KB |
03-07.txt | WA | 104 ms | 3968 KB |
03-08.txt | WA | 105 ms | 3968 KB |
03-09.txt | WA | 102 ms | 3840 KB |
03-10.txt | WA | 105 ms | 3968 KB |
03-11.txt | WA | 99 ms | 4096 KB |
03-12.txt | WA | 104 ms | 3968 KB |
03-13.txt | WA | 92 ms | 3968 KB |
03-14.txt | WA | 91 ms | 3968 KB |
03-15.txt | WA | 94 ms | 3968 KB |
03-16.txt | WA | 89 ms | 3968 KB |
03-17.txt | WA | 91 ms | 3968 KB |
03-18.txt | WA | 91 ms | 3968 KB |
sample-01.txt | AC | 1 ms | 256 KB |
sample-02.txt | AC | 1 ms | 256 KB |
sample-03.txt | AC | 1 ms | 256 KB |