結果
| 問題 |
No.365 ジェンガソート
|
| コンテスト | |
| ユーザー |
フクモトN
|
| 提出日時 | 2021-02-17 17:56:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,083 bytes |
| コンパイル時間 | 939 ms |
| コンパイル使用メモリ | 91,608 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-09-14 04:12:43 |
| 合計ジャッジ時間 | 5,008 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 TLE * 1 -- * 23 |
ソースコード
#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;
}
フクモトN