Submission #00181
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | #include<iostream> using namespace std; int main() { int n,a,now,m=0; int re=0; int p[5005]; cin>>n; for ( int i=0;i<n;i++){ now=i; cin>>p[i]; if (m<p[i]){ m=p[i]; a=now; } } while (m!=0){ if (a==0&&p[a+1]<=0){ re++; p[a]--; m--; } else if (a==n-1&&p[a-1]<=0){ re++; p[a]--; m--; } else if (p[a-1]<p[a+1]){ re+=2; p[a]--; p[a+1]--; m--; } else { re+=2; p[a]--; p[a-1]--; m--; } for ( int i=0;i<n;i++){ now=i; if (m<p[i]){ m=p[i]; a=now; } } } cout<<re<< '\n' ; return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0006 - パンケーキの焼き上がり |
ユーザー名 | はらしょー |
投稿日時 | 2018-08-07 11:18:32 |
言語 | C++ |
状態 | Wrong Answer |
得点 | 0 |
ソースコード長 | 689 Byte |
最大実行時間 | 44 ms |
最大メモリ使用量 | 704 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 0 / 10 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in01.txt | AC | 20 ms | 476 KB |
1
|
in02.txt | AC | 24 ms | 704 KB |
1
|
in03.txt | AC | 20 ms | 552 KB |
1
|
in04.txt | AC | 18 ms | 516 KB |
1
|
in05.txt | WA | 23 ms | 484 KB |
1
|
in06.txt | WA | 25 ms | 448 KB |
1
|
in07.txt | WA | 25 ms | 544 KB |
1
|
in08.txt | AC | 25 ms | 508 KB |
1
|
in09.txt | WA | 28 ms | 480 KB |
1
|
in10.txt | WA | 25 ms | 452 KB |
1
|
in11.txt | WA | 32 ms | 676 KB |
1
|
in12.txt | AC | 26 ms | 520 KB |
1
|
in13.txt | WA | 26 ms | 492 KB |
1
|
in14.txt | WA | 23 ms | 460 KB |
1
|
in15.txt | AC | 22 ms | 556 KB |
1
|
in16.txt | AC | 23 ms | 528 KB |
1
|
in17.txt | WA | 21 ms | 500 KB |
1
|
in18.txt | WA | 24 ms | 604 KB |
1
|
in19.txt | WA | 24 ms | 576 KB |
1
|
in20.txt | WA | 18 ms | 672 KB |
1
|
in21.txt | WA | 17 ms | 648 KB |
1
|
in22.txt | WA | 33 ms | 624 KB |
1
|
in23.txt | AC | 27 ms | 588 KB |
1
|
in24.txt | WA | 44 ms | 552 KB |
1
|
in25.txt | AC | 35 ms | 508 KB |
1
|
in26.txt | AC | 22 ms | 596 KB |
1
|
in27.txt | AC | 26 ms | 684 KB |
1
|
in28.txt | AC | 27 ms | 640 KB |
1
|
in29.txt | AC | 24 ms | 604 KB |
1
|
in30.txt | AC | 25 ms | 692 KB |
1
|