結果
問題 | No.397 NO MORE KADOMATSU |
ユーザー |
![]() |
提出日時 | 2017-08-24 17:05:44 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 552 bytes |
コンパイル時間 | 1,596 ms |
コンパイル使用メモリ | 172,088 KB |
実行使用メモリ | 25,604 KB |
平均クエリ数 | 640.78 |
最終ジャッジ日時 | 2024-07-16 14:04:47 |
合計ジャッジ時間 | 5,296 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 8 WA * 10 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 6 | main(){ | ^~~~
ソースコード
#include<bits/stdc++.h> typedef long long ll; using namespace std; int INF = 1e9; int MOD = 1e9+7; main(){ int N; cin >> N; int A[N]; vector<pair<int,int> > ans; for(int i = 0;i < N;i++)cin >> A[i]; for(int i = 0;i < N;i++){ for(int j = i;j+1 < N;j++){ if(A[j] > A[j+1]){ ans.push_back(make_pair(j,j+1)); swap(A[j],A[j+1]); } } } cout << ans.size() << endl; for(auto p:ans){cout << p.first << " " << p.second << endl;fflush(0);} cin >> N; }