Submission #2387934
Source Code Expand
#include<iostream> #include<cmath> using namespace std; int main() { int N,a[10000],i,sum=0;; cin>>N; a[0]=0;a[N]=0; for(i=1;i<=N;i++) { cin>>a[i]; } for(i=0;i<=N+1;i++) { sum+=abs(a[i+1]-a[i]); } for(i=1;i<=N;i++) { int s,x1,x2,x3; x1=abs(a[i]-a[i-1]); x2=abs(a[i+1]-a[i]); x3=abs(a[i+1]-a[i-1]); s=sum-x1-x2+x3; cout<<s<<endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Traveling Plan |
User | wd49798129 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 400 Byte |
Status | RE |
Exec Time | 288 ms |
Memory | 764 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample-01.txt, sample-02.txt, sample-03.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, sample-01.txt, sample-02.txt, sample-03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | RE | 288 ms | 764 KB |
02.txt | RE | 96 ms | 256 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | RE | 96 ms | 256 KB |
05.txt | RE | 96 ms | 256 KB |
06.txt | RE | 96 ms | 256 KB |
07.txt | RE | 96 ms | 256 KB |
08.txt | RE | 95 ms | 256 KB |
09.txt | RE | 95 ms | 256 KB |
10.txt | RE | 96 ms | 256 KB |
11.txt | RE | 95 ms | 256 KB |
12.txt | RE | 97 ms | 256 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 |