結果
| 問題 |
No.45 回転寿司
|
| ユーザー |
hiyori
|
| 提出日時 | 2016-04-03 01:37:18 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 439 bytes |
| コンパイル時間 | 478 ms |
| コンパイル使用メモリ | 61,616 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-24 11:23:38 |
| 合計ジャッジ時間 | 1,393 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 4 |
| other | WA * 30 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int N;
cin >> N;
vector<int> V(N);
for (int i = 0; i < N; i++) {
cin >> V[i];
}
int m = 0;
int c = 0;
for (int i = 0; i < N-1; i++) {
m += max(V[c], V[c+1]);
if (V[c] < V[c+1]) c += 2;
else c += 2+1;
cout << m << endl;
}
cout << m << endl;
return 0;
}
hiyori