結果

問題 No.451 575
ユーザー Lepton_sLepton_s
提出日時 2016-12-03 18:00:25
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,551 bytes
コンパイル時間 1,426 ms
コンパイル使用メモリ 76,696 KB
実行使用メモリ 5,260 KB
最終ジャッジ日時 2023-08-22 13:28:20
合計ジャッジ時間 6,100 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 WA -
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 4 ms
4,380 KB
testcase_06 AC 9 ms
4,380 KB
testcase_07 AC 66 ms
5,116 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 4 ms
4,380 KB
testcase_16 AC 12 ms
4,384 KB
testcase_17 AC 65 ms
5,224 KB
testcase_18 AC 66 ms
4,992 KB
testcase_19 AC 43 ms
4,440 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 1 ms
4,384 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 8 ms
4,376 KB
testcase_30 AC 65 ms
4,900 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 15 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<25;
typedef pair<int,int> P;
typedef long long ll;
typedef unsigned long long ull;

#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}


#define N 100010
ll n;
ll b[N], a[N+1];

int main(){
	cin>>n;
	rep(i, n) cin>>b[i];
	a[0] = 0;
	rep(i, n) a[i+1] = (-a[i]+b[i])*(i%2?-1:1);
	ll lb = 1, ub = 1e18;
	rep(i, n+1){
		int t = i%4;
		if(t==1||t==2){
			chmax(lb, -1e18+a[i]);
			chmin(ub, -1+a[i]);
		} else {
			chmax(lb, 1-a[i]);
			chmin(ub, 1e18-a[i]);
		}
	}
	if(lb>ub) cout<<-1<<endl;
	else {
		cout<<n+1<<endl;
		rep(i, n+1) cout<<a[i]+lb*((i&1)!=(i&2)?-1:1)<<endl;
	}

	return 0;
}
0