結果
問題 | No.397 NO MORE KADOMATSU |
ユーザー |
![]() |
提出日時 | 2018-06-17 15:22:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 52 ms / 2,000 ms |
コード長 | 714 bytes |
コンパイル時間 | 1,833 ms |
コンパイル使用メモリ | 171,008 KB |
実行使用メモリ | 25,604 KB |
平均クエリ数 | 936.56 |
最終ジャッジ日時 | 2024-07-17 01:46:06 |
合計ジャッジ時間 | 3,136 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 |
ソースコード
#include "bits/stdc++.h" #define REP(i,n,N) for(int i=(n); i<(N); i++) #define RREP(i,n,N) for(ll i=(N-1); i>=n; i--) #define CK(n,a,b) ((a)<=(n)&&(n)<(b)) #define ALL(v) (v).begin(),(v).end() #define p(s) cout<<(s)<<endl #define p2(a,b) cout<<(a)<<" "<<(b)<<endl typedef long long ll; using namespace std; const ll inf=1e18; int N; int a[110]; vector<pair<int,int>> vt; int main(){ cin>>N; REP(i,0,N){ cin>>a[i]; } REP(i,0,N){ REP(j,1,N){ if(a[j-1]>a[j]){ vt.emplace_back(j-1,j); swap(a[j-1],a[j]); } } } p(vt.size()); for(auto v:vt){ p2(v.first, v.second); } cin>>a[101]; return 0; }