結果

問題 No.397 NO MORE KADOMATSU
ユーザー karinohitokarinohito
提出日時 2023-10-06 01:17:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 979 bytes
コンパイル時間 2,148 ms
コンパイル使用メモリ 203,720 KB
実行使用メモリ 24,420 KB
平均クエリ数 651.67
最終ジャッジ日時 2023-10-06 01:17:14
合計ジャッジ時間 6,304 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 24 ms
23,388 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 26 ms
23,556 KB
testcase_10 WA -
testcase_11 AC 25 ms
24,036 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 25 ms
23,664 KB
testcase_17 AC 25 ms
23,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<time.h>
using namespace std;

using ll = long long;
#define rep(i,n) for(ll i=0;i<ll(n);i++)
#define all(A) A.begin(),A.end()
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vvvvll = vector<vvvll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using vvvvb = vector<vvvb>;

bool DEB = 0;

bool isbool(ll N){
    if(N<=1)return 0;
    for(ll i=2;i*i<=N;i++){
        if(N%i==0)return 0;
    }
    return 1;
}

ll modPow(ll a,ll n,ll mod){
    a%=mod;
    if(n==0)return 1;
    if(n%2==1)return (modPow(a,n-1,mod)*a)%mod;
    ll res=modPow(a,n/2,mod);
    return (res*res)%mod;
}

int main() {
    ll N;
    cin>>N;
    vll A(N);
    rep(i,N)cin>>A[i];
    vll L,R;
    rep(i,N)rep(j,N)rep(k,j)if(A[j]<A[k]){
        L.push_back(j+1);
        R.push_back(k+1);
        swap(A[j],A[k]);
    }
    ll M=L.size();
    cout<<M<<endl;
    rep(i,M)cout<<L[i]<<" "<<R[i]<<endl;
    cin>>N;
}
0