結果

問題 No.365 ジェンガソート
ユーザー フクモトN
提出日時 2021-02-17 17:48:08
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 1,050 bytes
コンパイル時間 920 ms
コンパイル使用メモリ 99,812 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-09-14 04:07:30
合計ジャッジ時間 4,873 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 TLE * 1 -- * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <iomanip>

using namespace std;
using ll = unsigned long long;

typedef pair<ll, ll> P;
map<int,int> dp;
vector<int> X;
vector<int> Y;
vector<int> Z;

int main(void){
    string a;
    getline(cin, a);
    string lineF;
    getline(cin, lineF);
    vector<int> N;
    istringstream iss(lineF);
    int k;
    while(iss >>k){
        N.push_back(k);
    }
    vector<bool> ansb(N.size(),false);
    for(int m=N.size()-1;m>=0;m--){
        int j=0;
        for(int r=m;r<N.size();r++){
            if(N[r]<N[m]){
                j = max(j,N[r]);
                ansb[r]=true;
            }
        }
        for(int s=0;s<m;s++){
            if(N[s]<j){
                ansb[s]=true;
            }
        }
    }
    int ans=0;
    for(int k=0;k<ansb.size();k++){
        if(ansb[k])ans++;
    }
    cout <<ans <<endl;
}
0