Submission #616105


Source Code Expand

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef pair<int, int> PI;
const double EPS=1e-9;



int main(void){
  int n;
  cin >> n;
  VI a(n - 1), b(n);
  REP(i, 0, n - 1) {
    cin >> a[i];
  }
  b[0] = a[0];
  b[n - 1] = a[n - 2];
  REP(i, 1, n - 1) {
    b[i] = min(a[i - 1], a[i]);
  }
  // check
  REP(i, 0, n - 1) {
    if (a[i] != max(b[i], b[i + 1])) {
      assert (!"error");
    }
  }
  REP(i, 0, n) {
    cout << b[i] << (i == n - 1 ? "\n" : " ");
  }
}

Submission Info

Submission Time
Task B - 積み鉛筆
User kobae964
Language C++ (GCC 4.9.2)
Score 80
Code Size 1024 Byte
Status AC
Exec Time 113 ms
Memory 1576 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 80 / 80
Status
AC × 3
AC × 15
Set Name Test Cases
Sample sample1.txt, sample2.txt, sample3.txt
All subtask0_0.txt, subtask0_1.txt, subtask0_10.txt, subtask0_11.txt, subtask0_12.txt, subtask0_13.txt, subtask0_14.txt, subtask0_2.txt, subtask0_3.txt, subtask0_4.txt, subtask0_5.txt, subtask0_6.txt, subtask0_7.txt, subtask0_8.txt, subtask0_9.txt
Case Name Status Exec Time Memory
sample1.txt AC 28 ms 736 KB
sample2.txt AC 26 ms 808 KB
sample3.txt AC 26 ms 804 KB
subtask0_0.txt AC 105 ms 1568 KB
subtask0_1.txt AC 88 ms 1448 KB
subtask0_10.txt AC 84 ms 1448 KB
subtask0_11.txt AC 97 ms 1564 KB
subtask0_12.txt AC 104 ms 1564 KB
subtask0_13.txt AC 88 ms 1568 KB
subtask0_14.txt AC 96 ms 1576 KB
subtask0_2.txt AC 85 ms 1312 KB
subtask0_3.txt AC 98 ms 1444 KB
subtask0_4.txt AC 89 ms 1572 KB
subtask0_5.txt AC 83 ms 1444 KB
subtask0_6.txt AC 99 ms 1440 KB
subtask0_7.txt AC 77 ms 1440 KB
subtask0_8.txt AC 95 ms 1556 KB
subtask0_9.txt AC 113 ms 1448 KB