結果

問題 No.2210 equence Squence Seuence
ユーザー kabipoyokabipoyo
提出日時 2023-02-10 22:06:50
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 1,447 bytes
コンパイル時間 10,150 ms
コンパイル使用メモリ 261,540 KB
実行使用メモリ 6,312 KB
最終ジャッジ日時 2023-09-21 23:23:09
合計ジャッジ時間 7,135 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 16 ms
4,376 KB
testcase_04 AC 18 ms
4,380 KB
testcase_05 AC 26 ms
4,376 KB
testcase_06 AC 23 ms
4,380 KB
testcase_07 AC 59 ms
5,768 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 73 ms
6,132 KB
testcase_14 AC 74 ms
6,236 KB
testcase_15 AC 74 ms
6,188 KB
testcase_16 AC 72 ms
6,312 KB
testcase_17 AC 73 ms
6,188 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 56 ms
5,712 KB
testcase_24 AC 43 ms
4,908 KB
testcase_25 AC 50 ms
5,128 KB
testcase_26 AC 67 ms
6,204 KB
testcase_27 AC 20 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef int64_t lint;
#define rep(i, n) for(int i=0; i<n; i++)
#define repx(i, l, n) for(int i=l; i<n; i++)
#define all(v) v.begin(), v.end()
#define show(x) cout << #x << ": " << x << endl;
#define list(x) cout << #x << ": " << x << "  ";
#define pb push_back
using vi = vector<lint>;
using vvi = vector<vector<lint>>;
template<class T> inline void vin(vector<T>& v) { rep(i, v.size()) cin >> v.at(i); }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline void drop(T x) { cout << x << endl; exit(0); }
template<class T> void vout(vector<T> v) { rep(i, v.size()) { cout << v.at(i) << ' '; } cout << endl; }
constexpr lint LINF = LLONG_MAX/2;

int main() {
	lint N, K;
	cin >> N >> K;
	vi v(N);
	vin(v);

	lint a=1, b=N, c=1, x, y, z;
	v.pb(LINF);
	rep(i, N) {
		if (v[i] > v[i+1]) {
			a += c;
			c = 1;
			if (a > K) {
				rep(j, N) {
					if (i == j) continue;
					cout << v[j] << ' ';
				}
				cout << endl;
				exit(0);
			}
		} else if (v[i] < v[i+1]) {
			b -= c;
			c = 1;
			if (b < K) {
				rep(j, N) {
					if (i == j) continue;
					cout << v[j] << ' ';
				}
				cout << endl;
				exit(0);
			}
		} else {
			c++;
		}
	}
	rep(j, N-1) {
		cout << v[j] << ' ';
	}
	cout << endl;
}
0