結果
問題 | No.1786 Maximum Suffix Median (Online) |
ユーザー |
![]() |
提出日時 | 2021-12-15 01:56:19 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 132 ms / 2,000 ms |
コード長 | 443 bytes |
コンパイル時間 | 1,983 ms |
コンパイル使用メモリ | 194,172 KB |
最終ジャッジ日時 | 2025-01-26 22:51:38 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:13:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%d",&N); | ~~~~~^~~~~~~~~ main.cpp:18:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 18 | scanf("%d",&A); | ~~~~~^~~~~~~~~
ソースコード
#include <stdio.h>#include <bits/stdc++.h>using namespace std;#define rep(i,n) for(int i=0;i<(n);i++)#define Inf 1000000001int main(){int last = 0;int N;scanf("%d",&N);multiset<int> S;S.insert(0);rep(i,N){int A;scanf("%d",&A);A ^= last;rep(j,2)S.insert(A+1);auto it = S.end();it--;S.erase(it);it = S.end();it--;int ok = *it;ok--;printf("%d\n",ok);last = ok;}return 0;}