結果
| 問題 | 
                            No.1425 Yet Another Cyclic Shifts Sorting
                             | 
                    
| コンテスト | |
| ユーザー | 
                             沙耶花
                         | 
                    
| 提出日時 | 2021-03-12 21:37:25 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 702 bytes | 
| コンパイル時間 | 4,566 ms | 
| コンパイル使用メモリ | 254,000 KB | 
| 最終ジャッジ日時 | 2025-01-19 14:22:55 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 17 WA * 31 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:25:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   25 |                 scanf("%d",&A[i]);
      |                 ~~~~~^~~~~~~~~~~~
            
            ソースコード
#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000000
int op(int a,int b){
	return max(a,b);
}
int e(){
	return 0;
}
int main(){
	
	int N;
	cin>>N;
	
	vector<int> A(N);
	rep(i,N){
		scanf("%d",&A[i]);
	}
	
	{
		auto B = A;
		sort(B.begin(),B.end());
		B.erase(unique(B.begin(),B.end()),B.end());
		
		rep(i,N){
			A[i] = distance(B.begin(),lower_bound(B.begin(),B.end(),A[i]));
		}
	}
	
	segtree<int,op,e> seg(N+5);
	
	rep(i,N){
		seg.set(A[i],max(seg.get(A[i]),seg.prod(0,A[i]+1)+1));
	}
	
	cout<<N-seg.all_prod()<<endl;
	
    return 0;
}
            
            
            
        
            
沙耶花