結果

問題 No.365 ジェンガソート
ユーザー sekiya9311
提出日時 2016-04-29 23:26:23
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,339 bytes
コンパイル時間 933 ms
コンパイル使用メモリ 99,588 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-04 19:03:27
合計ジャッジ時間 2,337 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>

#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define RREP(i,a) for(int (i)=(a)-1;(i)>=0;(i)--)
#define FORR(i,a,b) for(int (i)=(a)-1;(i)>=(b);(i)--)

typedef long long LL;
typedef unsigned long long ULL;

using namespace std;

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main(){
    int N; cin>>N;
    vector<int> a(N),aa(N);
    REP(i,N){
        cin>>a[i];
        aa[i]=a[i];
    }
    sort(a.begin(),a.end());
    if(a[N-1]==aa[N-1]){
        REP(i,N){
            if(a[0]==aa[i]){
                cout<<i<<endl;
                return 0;
            }
        }
    }else{
        REP(i,N){
            if(a[N-1]==aa[i]){
                int mmax=0;
                FOR(j,i+1,N){
                    mmax=max(mmax,aa[j]);
                }
                REP(j,N){
                    if(a[j]==mmax){
                        cout<<j+1<<endl;
                        return 0;
                    }
                }
            }
        }
    }
}
0