結果
| 問題 |
No.397 NO MORE KADOMATSU
|
| コンテスト | |
| ユーザー |
yuma25689
|
| 提出日時 | 2016-07-16 00:11:29 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 803 bytes |
| コンパイル時間 | 1,407 ms |
| コンパイル使用メモリ | 65,284 KB |
| 実行使用メモリ | 25,604 KB |
| 平均クエリ数 | 38.72 |
| 最終ジャッジ日時 | 2024-07-16 10:41:21 |
| 合計ジャッジ時間 | 5,607 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 WA * 13 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
typedef pair<int,int> PII;
void solve()
{
int N;
cin >> N;
vector<int> input(N+1);
for( int i=0; i<N; i++ )
{
cin >> input[i];
}
vector<PII> ans;
for( int i=N-1; 0<i; i-- )
{
if( input[i] < input[i-1] )
{
swap( input[i-1], input[i] );
ans.push_back( PII( i-1, i ) );
}
}
cout << ans.size() << endl;
for( auto itr = ans.begin(); itr != ans.end(); ++itr )
{
cout << itr->first+1 << " " << itr->second+1 << endl;
}
cout << flush;
int dummy;
cin >> dummy;
}
int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
solve();
return 0;
}
yuma25689