結果

問題 No.365 ジェンガソート
ユーザー フクモトNフクモトN
提出日時 2021-02-17 17:56:50
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,083 bytes
コンパイル時間 837 ms
コンパイル使用メモリ 89,400 KB
実行使用メモリ 4,724 KB
最終ジャッジ日時 2023-10-12 04:41:39
合計ジャッジ時間 5,000 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 1 ms
4,352 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,352 KB
testcase_06 AC 1 ms
4,352 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,352 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 2 ms
4,352 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,352 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 164 ms
4,724 KB
testcase_17 TLE -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
権限があれば一括ダウンロードができます

ソースコード

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--){
        if(ansb[m])continue;
        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