結果
| 問題 |
No.318 学学学学学
|
| コンテスト | |
| ユーザー |
しらっ亭
|
| 提出日時 | 2015-12-17 03:44:32 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 99 ms / 2,000 ms |
| コード長 | 550 bytes |
| コンパイル時間 | 1,763 ms |
| コンパイル使用メモリ | 170,976 KB |
| 実行使用メモリ | 8,704 KB |
| 最終ジャッジ日時 | 2024-06-22 16:06:01 |
| 合計ジャッジ時間 | 4,857 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:20:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
20 | scanf("%d", &ai);
| ~~~~~^~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define REP(i,n) for (int i = 0; i < (n); i++)
// -------------------------------------
typedef pair<int, int> PII;
int A[100001];
int main() {
int N;
cin >> N;
map<int, int> m;
REP(i, N) {
int ai;
scanf("%d", &ai);
m[ai] = i;
A[i] = ai;
}
set<int> s;
REP(i, N) {
if (i > 0) _P(" ");
int ai = A[i];
s.insert(ai);
_P("%d", *s.rbegin());
if (m[ai] == i) s.erase(ai);
}
_P("\n");
return 0;
}
しらっ亭