結果
問題 |
No.365 ジェンガソート
|
ユーザー |
![]() |
提出日時 | 2021-02-17 17:34:42 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,042 bytes |
コンパイル時間 | 919 ms |
コンパイル使用メモリ | 100,204 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-14 03:59:14 |
合計ジャッジ時間 | 2,711 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 WA * 38 |
ソースコード
#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){ int a=0; //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; }