結果

問題 No.1438 Broken Drawers
ユーザー Franny-Stein
提出日時 2021-03-26 22:01:40
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 622 bytes
コンパイル時間 761 ms
コンパイル使用メモリ 77,476 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-28 23:11:09
合計ジャッジ時間 2,941 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 1 WA * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<iterator>
using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<pair<int,int>> A(N);
    for(vector<pair<int,int>>::size_type i=0; i<N; i++)
    {
        cin >> A[i].first;
        A[i].second = i;
    }
    vector<pair<int,int>> B(A);
    sort(B.begin(), B.end());
    int ret = 0;
    for(vector<pair<int,int>>::size_type i=0; i<N; i++)
    {
        if(A[max(B[i].second-1,0)].first != -1)
        {
           A[B[i].second].first = -1 ;
           ret++;
        }
    }
    cout << ret << endl;
    
    return 0;
}
0