結果
| 問題 | No.318 学学学学学 |
| コンテスト | |
| ユーザー |
かに
|
| 提出日時 | 2015-12-11 02:13:18 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,250 bytes |
| 記録 | |
| コンパイル時間 | 2,542 ms |
| コンパイル使用メモリ | 165,068 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-15 07:50:11 |
| 合計ジャッジ時間 | 6,135 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 RE * 20 |
ソースコード
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0;i < n;i++)
#define REP(i,n,k) for(int i = n;i < k;i++)
#define P(p) cout<<(p)<<endl;
#define pi 3.1415926535
using namespace std;
typedef long long ll;
int dx[] = { 0, 1, 0, -1 };
int dy[] = { -1, 0, 1, 0 };
unsigned long long sttoi(std::string str) {
unsigned long long ret;
std::stringstream ss; ss << str;
ss >> ret;
return ret;
}
ll gcd(ll a, ll b){
if (b > a)swap(a, b);
if (b == 0) return a;
return gcd(b, a%b);
}
void solve() {
int n;
cin >> n;
int A[10000];
int ans[10000];
set<int> s;
rep(i, n){
cin >> A[i];
ans[i] = A[i];
s.insert(A[i]);
}
for (auto it = s.begin(); it != s.end(); it++){
int f = -1, e = -1;
rep(i, n){
if (f != -1 && e != -1){
for (int j = f; j <= e; j++){
ans[j] = *it;
}
f = -1;
e = -1;
}
if (A[i] == *it && f == -1){
f = i;
}
else if (A[i] == *it && f != -1){
e = i;
}
}
if (f != -1 && e != -1){
for (int i = f; i <= e; i++){
ans[i] = *it;
}
}
else if (f != -1){
ans[f] = *it;
}
}
rep(i, n){
cout << ans[i];
if (i != n - 1){
cout << " ";
}
}
cout << endl;
}
int main() {
solve();
return 0;
}
かに