結果

問題 No.397 NO MORE KADOMATSU
ユーザー karinohitokarinohito
提出日時 2023-10-06 01:19:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 975 bytes
コンパイル時間 2,108 ms
コンパイル使用メモリ 201,608 KB
実行使用メモリ 24,372 KB
平均クエリ数 651.67
最終ジャッジ日時 2023-10-06 01:19:13
合計ジャッジ時間 4,178 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
24,360 KB
testcase_01 AC 25 ms
23,532 KB
testcase_02 AC 25 ms
24,372 KB
testcase_03 AC 31 ms
24,372 KB
testcase_04 AC 25 ms
23,520 KB
testcase_05 AC 27 ms
24,048 KB
testcase_06 AC 27 ms
23,832 KB
testcase_07 AC 27 ms
23,424 KB
testcase_08 AC 25 ms
23,808 KB
testcase_09 AC 27 ms
24,012 KB
testcase_10 AC 56 ms
23,424 KB
testcase_11 AC 26 ms
24,000 KB
testcase_12 AC 27 ms
24,048 KB
testcase_13 AC 38 ms
23,364 KB
testcase_14 AC 39 ms
23,628 KB
testcase_15 AC 35 ms
24,036 KB
testcase_16 AC 25 ms
24,336 KB
testcase_17 AC 25 ms
23,400 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);
        R.push_back(k);
        swap(A[j],A[k]);
    }
    ll M=L.size();
    cout<<M<<endl;
    rep(i,M)cout<<L[i]<<" "<<R[i]<<endl;
    cin>>N;
}
0