結果

問題 No.2036 Max Middle
ユーザー vjudge1
提出日時 2025-10-09 15:07:36
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 495 bytes
コンパイル時間 1,985 ms
コンパイル使用メモリ 160,824 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-10-09 15:07:40
合計ジャッジ時間 4,477 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 4
other WA * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:13:12: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |     freopen("i.in","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~
main.cpp:14:12: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |     freopen("i.out","w",stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
/*
????????????????????????????????
=>?45? 
????????????????????????????
????????? 
???
*/ 
#define N 200005
int n,a[N];
int main(){
    freopen("i.in","r",stdin);
    freopen("i.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n;
    long long ans=0,up=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        if(i>1){
            if(a[i]>a[i-1])up++;
            else ans+=up;
        }
    }
    cout<<ans;
    return 0;
}
0